Age | Commit message (Collapse) | Author | Files | Lines |
|
To avoid closing the body fd prematurely, the fd value is moved from
the request struct to the app link. The body fd should not be closed
immediately after the request is sent to the application due to possible
request rescheduling.
|
|
This closes #386 on GitHub.
|
|
If the call is done only after a successful RPC data allocation, its
corresponding release call is not missed, which avoids a potential leak.
|
|
|
|
|
|
Router built with debug may stop with assertion during stalled requests
re-schedule. This was caused by missing reference counting increment
before nxt_router_port_select() call.
|
|
Re-scheduled req_app_link structures should have use_count exactly equal
to the number of references from the application and port list. However,
there's one extra usage decrement that occurs after the req_app_link is
created because the use_count is initialised as 1.
This patch removes all excess instances of the usage decrement that caused
preliminary req_app_link release and router process crash.
To reproduce the issue need to cause request rescheduling between 2 app
processes.
This issue was introduced in 61e9f23a566d.
|
|
- OOSM (out of shared memory). Sent by application process to router
when application reaches the limit of allocated shared memory and
needs more.
- SHM_ACK. Sent by router to application when the application's shared
memory is released and the OOSM flag is enabled for the segment.
This implements blocking mode (the library waits for SHM_ACK in case of
out of shared memory condition and retries allocating the required memory
amount) and non-blocking mode (the library notifies the application that
it's out of shared memory and returns control to the application module
that sets up the output queue and puts SHM_ACK in the main message loop).
|
|
The reason for the change is that the req_app_link reference count
was incorrect if the application crashed at start; in this case,
the nxt_request_app_link_update_peer() function was never called.
This closes #332 issue on GitHub.
|
|
|
|
|
|
|
|
|
|
|
|
The "nxt_http_websocket" request state, defined in "nxt_http_websocket.c",
is used in "nxt_router.c" and must be linked with external symbol declared
in "nxt_router.c".
Due to the missing "extern" keyword, building Unit with some linkers
(notably gold and LLD) caused WebSocket connections to get stuck or even
crash the router process.
|
|
|
|
|
|
Request state ready_handler required for further websocket events processing.
It is not required for regular response transferring.
|
|
Fields are filtered one by one before being added to fields list.
This avoids adding and then skipping connection-specific fields.
|
|
- nxt_req_app_link_t -> nxt_request_app_link_t
- nxt_req_conn_link_t -> nxt_request_rpc_data_t
Corresponding abbreviated field names also changed:
- ra -> req_app_link
- rc -> req_rpc_data
|
|
Now it's possible to delete "listeners" and "applications" objects.
This closes #187 issue on GitHub.
|
|
|
|
Before this fix, request in router may hang until timeout expired if
application crashed during request processing.
|
|
This closes #223 issue on GitHub.
|
|
|
|
|
|
|
|
This message produces too many noise in log and complicates analysis.
|
|
Previously, the nxt_router_prepare_msg() function expected server host among
other headers unmodified. It's not true anymore since normalization of the
Host header has been introduced in 77aad2c142a0.
The nxt_unit_split_host() function was removed. It didn't work correctly with
IPv6 literals. Anyway, after 77aad2c142a0 the port splitting is done in router
while Host header processing.
|
|
|
|
It doesn't do anything useful, among creating a JSON message and logging it
to debug log. Besides that it causes segmentation fault if the RPC handler
is triggered with an empty buffer due to exiting of the main process.
|
|
This fixes memory leak if configuration uses more than one TLS cerificate.
|
|
|
|
Timers that don't require maximum precision (most of them, actually) can be
triggered earlier or later within the bias interval.
To reduce wakeups by timers, the expire function now triggers not only all
timers that fall within the elapsed time, but also those whose bias falls
within this interval.
|
|
There's nothing specific to Go language. This type of application object can
be used to run any external application that utilizes libunit API.
|
|
Router reconfiguration may lead to starting new application processes, opening
listen ports etc. These actions are asynchronous and require message
exchange with master process. Router stores reference for controller
(response) port in structure associated with reconfiguration process (tmcf).
The port used to provide reconfiguration response (either success or failed)
to controller.
This commit increases response port use counter to make sure port structure
not freed while router waits for result of asynchronous operations.
|
|
|
|
|
|
Attribute 'application' is optional in listener object. This commit adds
missing code to reset 'lscf' to avoid garbage and crash when the attribute
is absent.
|
|
For accurate app descriptor release, it is required to count the number of
use counts. Use count increased when:
- app linked to configuration app queue;
- socket conf stores pointer to app;
- request for start app process posted to router service thread;
Application port has pointer to app, but it does not increase use count
to avoid use count loop.
Timer needs a pointer to nxt_timer_t which is stored in engine timers tree.
nxt_timer_t now resides in nxt_app_joint_t and does not lock the application.
Start process port RPC handlers is also linked to nxt_app_joint_t.
App joint (nxt_app_joint_t) is a 'weak pointer':
- single threaded;
- use countable;
- store pointer to nxt_app_t (which can be NULL);
nxt_app_t has pointer to nxt_app_joint_t and update its pointer to app.
|
|
Library now used in all language modules.
Old 'nxt_app_*' code removed.
See src/test/nxt_unit_app_test.c for usage sample.
|
|
It has the following structure and default values:
{
"http": {
"header_read_timeout": 30,
"body_read_timeout": 30,
"send_timeout": 30,
"idle_timeout": 180,
"max_body_size": 8388608
}
}
|
|
|
|
The implementation of module was based on the assumption that PHP reads request
body and headers in the particular order. For the POST request the body goes
before headers and vice versa for all other requests.
But as it appeared later, this order is unspecified and depends on many factors,
including the particular code of PHP application. Among other factors those
can affect ordering:
- presence of "Content-Type" header;
- "variables_order" php.ini setting;
- "enable_post_data_reading" php.ini setting;
- reading php://input by application;
and this list can be incomplete.
As a temporary workaround, request body now is always put before headers and it
is gracefully skipped whenever PHP wants to get headers.
This closes #144 issue on GitHub.
|
|
|
|
|
|
Found by Coverity (CID 276138).
|
|
This required to avoid racing condition when controller receive router
port before router receives controller port.
|
|
In order to reopen access log, the router process creates a memory pool
and allocates a buffer to send RPC message for the main process.
Previously, the memory pool was destroyed when RPC response handler was
called. It appeared, that the buffer completion handler could be not
triggered by that time and still remained in a queue.
Now the memory pool is destroyed only after both events are happen.
|
|
|