Commit Graph

78 Commits

Author SHA1 Message Date
Valentin Bartenev
45c1d41f34 Removed fibers from compilation.
It's not used anyway, but breaks building with musl.

This closes issue #5 on GitHub.
2017-09-22 16:42:42 +03:00
Max Romanov
838d9946ac Introducing named port message handlers to avoid misprints. 2017-09-15 20:30:34 +03:00
Max Romanov
1449e27cb4 Fixing memory leak of request parse context. 2017-09-15 20:30:29 +03:00
Max Romanov
0bec14878e Introducing application timeout. 2017-09-15 20:30:24 +03:00
Valentin Bartenev
90ae152ce0 Fixed port handlers arrays. 2017-09-15 14:38:22 +03:00
Igor Sysoev
7c1db30994 Router: more logical code order change.
Updating the router engines list before posting jobs to worker thread
engines is more logical because worker threads may exit after the posting.
However, the previous code was safe because an engine is freed by
the router main thread after worker its thread has exited.
2017-09-15 12:27:24 +03:00
Igor Sysoev
309ba5abf2 Router: fixed segmentation fault.
The router process exited abnormally on reconfiguration if number
of worker threads had been decreased on the previous reconfiguration.
Besides the list of router engines should be updated only after a new
configuration joints have been prepared for all engines.
2017-09-14 22:30:38 +03:00
Igor Sysoev
72c3e08158 Router: worker threads should quit only if the main thread has
requested this.
2017-09-14 19:53:25 +03:00
Igor Sysoev
4d5e39e8c1 Fixed textual socket name lengths and Unix domain sockaddr length. 2017-09-14 18:16:22 +03:00
Max Romanov
d87a4fb642 Moving body data before headers for PHP POST.
PHP SAPI tries to read body for POST request before registering
header-specific variables. For other methods, read_post_body() called by SAPI
after variables registration.

This closes #10 issue on GitHub.
2017-09-07 16:39:31 -07:00
Igor Sysoev
58907888e5 Style fixes. 2017-09-06 02:30:55 +03: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
Igor Sysoev
ff515f4312 Added SERVER_ADDR parameter for Python and PHP modules. 2017-09-01 07:54:01 +03: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
9537821f3f Send remote address to go application. 2017-08-30 11:50:29 -07:00
Max Romanov
6de7cc8634 Fixed debug message broken in e8da77a2c293. 2017-08-29 14:17:59 -07:00
Igor Sysoev
9d487df10d The master process has been renamed to the main process. 2017-08-29 02:59:35 +03:00
Igor Sysoev
897b860e83 Introduced nxt_socket_defer_accept(). 2017-08-26 13:37:39 +03:00
Igor Sysoev
949548da29 The new module configuration interface.
Configuration and building example:

  ./configure
  ./configure python
  ./configure php
  ./configure go
  make all

or

  ./configure
  make nginext
  ./configure python
  make python
  ./configure php
  make php
  ./configure go
  make go

Modules configuration options and building examples:

  ./configure python --module=python2 --config=python2.7-config
  make python2

  ./configure php --module=php7 --config=php7.0-config
                  --lib-path=/usr/local/php7.0
  make php7

  ./configure go --go=go1.6 --go-path=${HOME}/go1.6
  make go1.6
2017-08-17 21:47:19 +03:00
Valentin Bartenev
95907e2912 Object mapping interface extended with more string types. 2017-08-16 15:45:12 +03:00
Valentin Bartenev
80deee3903 Controller: more HTTP headers and detailed JSON parsing errors. 2017-08-11 19:54:40 +03:00
Max Romanov
39a6a4c973 Request body read state implemented.
With specific timeout and buffer size settings.
2017-08-11 18:04:04 +03:00
Igor Sysoev
a94178a05e Listening socket creation and binding operations are passed
to the master process.
2017-08-02 21:11:20 +03:00
Max Romanov
b150f07e80 Added basic port error handler. 2017-08-02 13:36:29 +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
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
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
Igor Sysoev
a782faa499 Listening sockets remaining from the previous configuration
were not updated with new parameters.
2017-07-19 22:36:03 +03:00
Igor Sysoev
21de5c1d18 Added application name in process title. 2017-07-18 22:27:13 +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
Igor Sysoev
6fc7b70646 Router configuration retention count fixed. 2017-07-16 19:56:09 +03:00
Igor Sysoev
6044e6f44f Router: joint must be added to engine's joint list in the
engine thread.
2017-07-16 19:55:56 +03:00
Igor Sysoev
b3464d563e Router: joint must be checked before memory pool destruction. 2017-07-14 20:34:38 +03:00
Igor Sysoev
b5d0920491 Router: listening socket configuration retention count fixed. 2017-07-14 20:34:33 +03:00
Igor Sysoev
3ed35d725a Router: using joint job queues instead of arrays to pass
listening socket handlers to worker engines.
2017-07-14 17:17:15 +03:00
Igor Sysoev
668aabac3c Router: using joint jobs to pass listening socket handlers to
worker engines.
2017-07-14 17:17:15 +03:00
Igor Sysoev
c5d791d0c4 Router: restoring listening sockets of the previous configuration. 2017-07-13 16:48:28 +03:00
Igor Sysoev
0324d51b8d Closing new listening sockets on configuration failure. 2017-07-12 21:21:00 +03:00