Age | Commit message (Collapse) | Author | Files | Lines |
|
One of the ways to detect Unit's startup and subsequent readiness to accept
commands relies on waiting for the control socket file to be created.
Earlier, it was unreliable due to a race condition between the client's
connect() and the daemon's listen() calls after the socket's bind() call.
Now, unix domain listening sockets are created with a nxt_listen_socket_create()
call as follows:
s = socket();
unlink("path/to/socket.tmp")
bind(s, "path/to/socket.tmp");
listen(s);
rename("path/to/socket.tmp", "path/to/socket");
This eliminates a time-lapse when the socket file is already created but nobody
is listening on it yet, which therefore prevents the condition described above.
Also, it allows reliably detecting whether the socket is being used or simply
wasn't cleaned after the daemon stopped abruptly. A successful connection to
the socket file means the daemon has been started; otherwise, the file can be
overwritten.
|
|
Previously, the unix domain control socket file might have been left
in the file system after a failed nxt_listen_socket_create() call.
|
|
|
|
|
|
This is required for Express framework compatibility.
This closes #418 issue on GitHub.
|
|
Missing error log messages added.
|
|
This silences the -Wimplicit-int-float-conversion warning.
|
|
|
|
|
|
Main process exiting before app process init may have caused hanging.
|
|
This is required for proper log file rotation action.
|
|
|
|
This allows to specify redirects:
{
"action": {
"return": 301,
"location": "https://www.example.com/"
}
}
|
|
|
|
Now '>', '<', '"', '^', '\', '}', '|', '{', and '`' are also escaped.
|
|
The "return" action can be used to immediately generate a simple HTTP response
with an arbitrary status:
{
"action": {
"return": 404
}
}
This is especially useful for denying access to specific resources.
|
|
|
|
Unclosed multi-line comments and "/" at the end of JSON shouldn't be allowed.
|
|
This fixes crash introduced in 039b00e32e3d.
|
|
Before this fix, only persistent connection request buffers were completed.
This issue was introduced in dc403927ab0b.
|
|
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.
|
|
The check was moved from the request body read stage.
|
|
|
|
Ruby and Java modules now use this function instead of own
implementations.
|
|
|
|
|
|
|
|
|
|
Found by Coverity: CID 354832 and CID 354833.
|
|
If kqueue reported both the EVFILT_READ and the EVFILT_WRITE events
for the socket but only the former had the EV_EOF flag set, the flag
was silently ignored.
|
|
It allows proceeding to another action if a file isn't available.
An example:
{
"share": "/data/www/",
"fallback": {
"pass": "applications/php"
}
}
In the example above, an attempt is made first to serve a request with
a file from the "/data/www/" directory. If there's no such file, the
request is passed to the "php" application.
Fallback actions may be nested:
{
"share": "/data/www/",
"fallback": {
"share": "/data/cache/",
"fallback": {
"proxy": "http://127.0.0.1:9000"
}
}
}
|
|
Now it enforces the mutual exclusivity of "pass", "proxy", and "share" options.
|
|
For each request, the worker calls the php_execute_script function
from libphp that changes to the script directory before doing its
work and then restores the process directory before returning. The
chdir(2) calls it performs are unnecessary in Unit design. In simple
benchmarks, profiling shows that the chdir syscall code path (syscall,
FS walk, etc.) is where the CPU spends most of its time.
PHP SAPI semantics requires the script to be run from the script
directory. In Unit's PHP implementation, we have two use cases:
- script
- arbitrary path
The "script" configuration doesn't have much need for a working
directory change: it can be changed once at module initialization.
The module needs to chdir again only if the user's PHP script also
calls chdir to switch to another directory during execution.
If "script" is not used in Unit configuration, we must ensure the
script is run from its directory (thus calling chdir before exec),
but there's no need to restore the working directory later.
Our implementation disables mandatory chdir calls with the SAPI
option SAPI_OPTION_NO_CHDIR, instead calling chdir only when needed.
To detect the user's calls to chdir, a simple "unit" extension is
added that hooks the built-in chdir() PHP call.
|
|
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.
|
|
This closes #403 issue on GitHub.
|
|
|
|
|
|
Some editors can add it to JSON files.
|
|
This allows to have JavaScript-like comments in the uploading JSON.
|
|
This closes #370 in GitHub.
|
|
This issue was introduced in 2c7f79bf0a1f.
|
|
Uninitialized ctx_impl field may cause crash in application process.
To reproduce the issue, need to trigger shared memory buffer send error on
application side. In our case, send error caused by router process crash.
This issue was introduced in 2c7f79bf0a1f.
|
|
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.
|
|
This is required to avoid dereference of freed memory.
Found by Coverity (CID 353372).
|
|
Found by Coverity (CID 353386).
|
|
Found by Coverity (CID 353389).
|
|
A check for the ".php" extension is added to prevent execution of files
with arbitrary extensions in cases where "index" and "script" options
aren't used.
|
|
This closes #363 issue on Github.
Thanks to to 洪志道 (Hong Zhi Dao).
|