Max Romanov
05f93d931b
Fixed go package installation instructions.
2017-09-05 22:31:57 -07:00
Max Romanov
76f3d7435f
Added software installation instructions for CentOS.
2017-09-05 18:04:46 -07:00
Max Romanov
f0723995a7
Fixing request id logging.
2017-09-05 15:56:37 -07:00
Max Romanov
0f9f0ca522
Fixing racing condition on app port release/request.
...
Application free ports is a queue (double linked list) protected with mutex.
After successfull request parsing, each router thread (1) tries to get port
from this list. If this list is empty, (2) start worker request posted to main
router thread. Another thread may release port between (1) and (2).
This fix adds an attempt to get port from free ports list at the beginning of
start worker action in main thread.
2017-09-05 15:56:35 -07:00
Max Romanov
c937b8434a
Double connection close attempt fix.
2017-09-05 10:22:46 -07:00
Max Romanov
1429cacd17
Using CSTRZ mapping type for go executable.
2017-09-05 10:22:45 -07:00
Max Romanov
f1685e371f
Introducing working_directory directive for applications.
2017-09-05 10:22:44 -07:00
Max Romanov
ac7218e335
Introducing install & uninstall Makefile targets.
2017-08-31 11:42:13 -07:00
Max Romanov
6eb4a41364
Multiplexing different requests in single app port.
2017-08-31 11:42:12 -07:00
Max Romanov
fc687e0508
Default value 1 for number of workers.
2017-08-31 11:42:11 -07:00
Max Romanov
e06872e2f2
Avoid nxt_port_mmap_header_t redefinition warning.
2017-08-30 14:34:31 -07:00
Max Romanov
d3f19d98ca
Avoid nxt_go_process_t redefinition warning.
2017-08-30 12:08:29 -07:00
Max Romanov
a33145d614
ListenAndServe changed to be compatible with http.ListenAndServe.
2017-08-30 11:50:33 -07:00
Max Romanov
9537821f3f
Send remote address to go application.
2017-08-30 11:50:29 -07:00
Max Romanov
9791b09ce3
Fixed pid_file pattern misprint introduced in 231:6832cdee961e.
2017-08-30 11:50:16 -07:00
Max Romanov
92f3b85298
The process type enum exposed to go module.
2017-08-29 14:18:00 -07:00
Max Romanov
6de7cc8634
Fixed debug message broken in e8da77a2c293.
2017-08-29 14:17:59 -07:00
Max Romanov
5b879f0e2b
Using NXT_GO variable instead of explicit go.
2017-08-29 11:37:49 -07:00
Max Romanov
52ae0e69c1
Store and use NXT_LIBRT for go module.
2017-08-29 11:33:35 -07:00
Max Romanov
73dc76b0bf
Separation of module prerequisites for 'all' target in Makefile.
...
To avoid using sed -i.
2017-08-29 11:33:34 -07:00
Max Romanov
39a6a4c973
Request body read state implemented.
...
With specific timeout and buffer size settings.
2017-08-11 18:04:04 +03:00
Max Romanov
e1e808bd94
Sync flag introduced for port type.
...
To avoid transfer mmap_msg before new mmap message.
2017-08-11 18:04:04 +03:00
Max Romanov
162afe4719
RPC: peer pid special value -1 may be used if pid is unknown.
2017-08-11 18:04:04 +03:00
Max Romanov
1b354421c3
Tiny mmap buffers completion fixed.
...
Small mmap buffers transferred in 'plain' mode and should be freed by sender.
2017-08-11 18:04:04 +03:00
Max Romanov
b150f07e80
Added basic port error handler.
2017-08-02 13:36:29 +03:00
Max Romanov
f23f985899
Runtime processes protected with mutex.
2017-08-02 13:22:07 +03:00
Max Romanov
021a84019f
Freed mmap memory filled with 0xA5.
2017-08-02 13:22:03 +03:00
Max Romanov
9367dd2bf8
Implicit port read buffer completion.
...
To disable implicit completion, handler should reset msg->buf field.
2017-08-02 13:21:32 +03:00
Max Romanov
bcf99f87e2
Using port rpc in controller->router configuration update.
2017-08-02 13:20:57 +03:00
Max Romanov
82c0304ab8
Using port rpc in router->master start worker request.
2017-08-02 13:20:53 +03:00
Max Romanov
c93d2c7623
Include build/Makefile into main Makefile.
2017-08-02 13:18:04 +03:00
Max Romanov
f2e9afdf42
Port RPC interface introduced.
...
Usage:
1. Register handlers in incoming port with nxt_port_rpc_register_handler().
2. Use return value as a stream identifier for next nxt_port_socket_write().
2017-08-02 13:14:31 +03:00
Max Romanov
3812ffd336
Added bit flags to type parameter of nxt_port_socket_write().
...
NXT_PORT_MSG_LAST - mark message as last;
NXT_PORT_MSG_CLOSE_FD - close fd right after send;
Type constants altered to include last flag for single buffer messages.
Last sign is critical for coming port RPC layer. Handlers unregistered on last
message. Create sync buffer is not convenient, extra parameter is better.
2017-08-02 13:10:48 +03:00
Max Romanov
a7ef8481fc
Added make target 'golang-nginext-install' to install precompiled go package.
2017-08-02 13:01:54 +03:00
Max Romanov
83d7ab38ac
Using old-style packed attribute specification for compatibility.
2017-08-02 13:01:54 +03:00
Max Romanov
057c2526ee
Assign current request id to prevent port memory release.
2017-07-25 16:18:31 +03:00
Max Romanov
5a756647ff
Using engine task to avoid racing condition.
2017-07-25 16:18:31 +03:00
Max Romanov
316c77a9de
Fixed building on Solaris by Sun C.
2017-07-25 16:18:31 +03:00
Max Romanov
6b6fefa497
Request-app link introduced to prevent mp destroy for penging requests.
...
nxt_req_conn_link_t still used for lookup connection by request id.
New nxt_req_app_link_t (ra) allocated from conn->mem_pool using mp_retain().
ra stored in app->requests if there is no free worker to process request.
2017-07-18 00:21:28 +03:00
Max Romanov
31e5992f88
Using correct task for engine post.
2017-07-18 00:21:18 +03:00
Max Romanov
8ad2c3fd3a
Work queue thread assertions. Reset thread after fork.
2017-07-18 00:21:17 +03:00
Max Romanov
803855138c
Mem pool cleanup introduced.
...
Used for connection mem pool cleanup, which can be used by buffers.
Used for port mem pool to safely destroy linked process.
2017-07-18 00:21:16 +03:00
Max Romanov
eb675f2d78
Port allocation and destroy changed. Worker process stop introduced.
2017-07-18 00:21:14 +03:00
Max Romanov
47b359388c
Python: typo fixed in string processing shortcut.
2017-07-18 00:21:13 +03:00
Max Romanov
288fa85431
Array elements reallocation fixed.
2017-07-12 20:32:22 +03:00
Max Romanov
48afadfe7c
Memory pool debug enabled with NXT_DEBUG_ALLOC define.
2017-07-12 20:32:20 +03:00
Max Romanov
7d3fd1c96c
Single allocation for app conf and name.
2017-07-12 20:32:19 +03:00
Max Romanov
a97a5e8a0b
Go: worker initialization. READY message to master.
2017-07-12 20:32:18 +03:00
Max Romanov
51bbdd3338
PHP SAPI: dynamic worker initialization.
2017-07-12 20:32:17 +03:00
Max Romanov
b0c1e740cf
New process port exchange changed. READY message type introduced.
...
Application process start request DATA message from router to master.
Master notifies router via NEW_PORT message after worker process become ready.
2017-07-12 20:32:16 +03:00
Max Romanov
e41425bb1f
Router: connection destroy sequence fixed.
2017-07-07 18:16:14 +03:00
Max Romanov
9a402ea83d
Taken counter initialized for new pages.
...
Fixed crash in nxt_mp_get() when pages re-used and 'taken' contains initial
'map' value '0xFFFFFFFF'.
2017-07-07 16:01:34 +03:00
Max Romanov
e58f4ef0d0
Memory pool thread safety checks in DEBUG build and usage fixes.
2017-07-07 16:01:34 +03:00
Max Romanov
e15b975e9d
Work queue thread safety checks for DEBUG build.
2017-07-07 16:01:34 +03:00
Max Romanov
5529e9f0d1
Python initialization moved from master to worker application.
2017-07-07 16:01:34 +03:00
Max Romanov
74cda90e31
Process stop notification from master to all other processes.
...
New port message type introduced NXT_PORT_MSG_REMOVE_PID. Default handler
removes process description from nxt_runtime_t with all ports, incoming and
outgoing mmaps etc.
2017-07-07 16:01:34 +03:00
Max Romanov
61008a7c0b
Cosmetic changes to remove some annoying valgrind messages.
2017-07-07 16:01:34 +03:00
Max Romanov
264ae98d49
Using engine's task instead of listen's task.
2017-07-07 16:01:34 +03:00
Max Romanov
f319220a6c
Redirecting buffer completion handler to specific engine.
...
There is a case in router where we use port in router connection thread.
Buffers are allocated within connection memory pool which can be used only in
this router thread. sendmsg() can be postponed into main router thread and
completion handler will compare current engine and post itself to correct
engine.
2017-07-07 16:01:34 +03:00
Max Romanov
c56d2af3bc
Router: read configuration from port.
...
Controller: stub to send configuration from POST body "as is" to router.
2017-07-06 18:38:51 +03:00
Max Romanov
d28d502aa5
PHP SAPI: SERVER_NAME, SERVER_PORT and REMOTE_ADDR introduced.
2017-07-05 13:32:02 +03:00
Max Romanov
41e2678110
Python WSGI: SERVER_NAME, SERVER_PORT fixed, REMOTE_ADDR introduced.
...
Shortcut: do not iterate over String (or Bytes) return object.
Call 'close()' for return object (if present).
2017-07-05 13:31:53 +03:00
Max Romanov
f3107f3896
Complex target parser copied from NGINX.
...
nxt_app_request_header_t fields renamed:
- 'path' renamed to 'target'.
- 'path_no_query' renamed to 'path' and contains parsed value.
2017-07-05 13:31:45 +03:00
Max Romanov
44b3ad17f4
Double buf completion call on connection timeout fixed.
2017-06-26 19:58:43 +03:00
Max Romanov
d62e6c3b18
PHP post body processing fixed, default index name introduced.
2017-06-26 19:58:43 +03:00
Max Romanov
b53b7b0413
Build on Solaris 11 fixed.
2017-06-26 19:58:43 +03:00
Max Romanov
83088a0f4b
Incoming and outgoing port_mmap arrays are protected with mutexes.
2017-06-23 19:20:08 +03:00
Max Romanov
abe0d33329
Increased size of iovec when data passed using shared memory.
...
Useful for tiny shared memory segment test case.
2017-06-23 19:20:08 +03:00
Max Romanov
b8f126dcdf
Added basic HTTP request processing in router.
...
- request to connection mapping in engine;
- requests queue in connection;
- engine port creation;
- connected ports hash for each process;
- engine port data messages processing (app responses);
2017-06-23 19:20:08 +03:00
Max Romanov
4a1b59c27a
External Go app request processing.
2017-06-23 19:20:08 +03:00
Max Romanov
5a43bd0bfd
PHP app request processing.
2017-06-23 19:20:08 +03:00
Max Romanov
fa6582d9ad
Python app request processing.
2017-06-23 19:20:08 +03:00
Max Romanov
e7a0634a71
Application-side message processing.
...
Usage on the router side:
nxt_app_wmsg_t wmsg;
nxt_app_parse_ctx_t parse_ctx;
nxt_app_http_req_init(task, &parse_ctx);
/* parse incoming request data */
if (nxt_app_http_req_parse(task, &parse_ctx, buf) == NXT_DONE) {
/* choose app */
nxt_app = nxt_select_app(... &parse_ctx.r ...);
/* find port */
wmsg.port = nxt_get_app_port(... nxt_app ...);
wmsg.buf = &wmsg.write;
/* fill write message buffer in shared mem */
nxt_app->prepare_msg(task, &parse_ctx.r, &wmsg);
/* send message to app for processing */
nxt_port_socket_write(task, wmsg.port, NXT_PORT_MSG_DATA,
-1, 0, 0, wmsg.write);
}
2017-06-23 19:20:08 +03:00
Max Romanov
3b9aa27625
Added mem_pool pointer member to nxt_port_send_msg_t.
...
To decouple nxt_port_send_msg_t from port.
2017-06-23 19:20:08 +03:00
Max Romanov
eaf28db46e
Moved message size to nxt_port_recv_msg_t for convenience.
2017-06-23 19:20:08 +03:00
Max Romanov
3e989a165c
Extruded nxt_port_send_port() to send port to one process.
2017-06-23 19:20:08 +03:00
Max Romanov
0cd9521687
Store pointer to shared memory start in buf->parent.
...
nxt_port_mmap_t stored in arrays and it is unsafe to store
pointer to array element.
Shared memory structures and macros moved to separate header
file to be used by GO package.
2017-06-23 19:20:04 +03:00
Max Romanov
b13cdb0faa
Store mem_pool in buf->data instead of port for consistency.
2017-06-23 19:19:41 +03:00
Max Romanov
ac43bfcc72
nxt_process_create() changed to add process to runtime before callbacks.
2017-06-23 19:19:41 +03:00
Max Romanov
e5fe254e1e
nxt_port_create() use task instead of thread.
...
Write socket close() call moved out from nxt_port_create().
2017-06-23 19:19:41 +03:00
Max Romanov
89ab9a9d05
Shorter shared memory name generated.
2017-06-23 19:19:41 +03:00
Max Romanov
0fdcdde6c8
lvlhash for ports moved to separate files for future re-use.
2017-06-23 19:19:41 +03:00
Max Romanov
58e20da984
Runtime ports fix, add enumeration macros.
2017-06-23 19:19:41 +03:00
Max Romanov
952ec2e0ff
Fixed building test on Solaris
2017-05-12 20:41:34 +03:00
Max Romanov
f7b4bdfd89
Using shared memory to send data via nxt_port.
...
Usage:
b = nxt_port_mmap_get_buf(task, port, size);
b->mem.free = nxt_cpymem(b->mem.free, data, size);
nxt_port_socket_write(task, port, NXT_PORT_MSG_DATA, -1, 0, b);
2017-05-12 20:32:41 +03:00
Max Romanov
cfed068c1d
Macros for atomic 'OR' and 'AND' operations introduced.
...
Compiler built-ins used, where possible. Necessary configure checks added.
New macros:
nxt_atomic_or_fetch(ptr, val)
nxt_atomic_and_fetch(ptr, val)
Syntax and behaviour is similar to __sync_or_and_fetch and __sync_and_and_fetch
GCC build-ins.
2017-04-21 16:55:13 +03:00