summaryrefslogtreecommitdiffhomepage
path: root/src (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-09-18Updated racially charged language in messages and comments.Artem Konev2-4/+4
2020-09-18Python: app module callable name configuration.Max Romanov4-5/+21
Now it is possible to specify the name of the application callable using optional parameter 'callable'. Default value is 'application'. This closes #290 issue on GitHub.
2020-09-18Fixed segmentation fault during reconfiguration.Igor Sysoev1-7/+3
If idle connection was closed before h1proto had been allocated then c->socket.data is NULL. This happens if nxt_h1p_idle_response() is called by nxt_h1p_idle_close(). However, h1p->conn_write_tail is used only in nxt_h1p_request_send() that would not be called after nxt_h1p_idle_response(). The bug was introduced in f237e8c553fd.
2020-09-18Fixed segmentation fault during reconfiguration.Igor Sysoev1-1/+9
2020-09-18Fixed use-after-free error during reconfiguration.Igor Sysoev1-0/+2
An idle connection was not removed from idle connection list if the connections detected that listening socket had been closed.
2020-08-28Router: fixed "pass" to upstreams.hongzhidao3-3/+11
Messed up return values in nxt_upstream_find() caused error in applying any configuration with a valid "pass" value in router configuration pointing to upstream. That wasn't the case in "listeners" objects, where the return value wasn't checked. Also, it caused segfault in cases where the "pass" option was configured with variables and resulting value was pointing to a non-existent upstream. Added missing return checks as well to catch possible memory allocation errors. The bug was introduced in d32bc428f46b. This closes #472 issue on GitHub.
2020-09-16Isolation: remove redundant macro.Tiago Natel de Moura2-4/+1
2020-09-15Python: changed request headers format in router protocol.Max Romanov2-11/+107
The coming ASGI support requires raw HTTP headers format. Headers grouping and upcase code were moved to WSGI module.
2020-09-15Hardening header names comparation for grouping.Max Romanov1-10/+67
2020-09-14Python: split module initialization from WSGI implementation.Max Romanov3-285/+387
This is required for futher ASGI implementation.
2020-09-14Python: source file moved to 'python' sub-directory.Max Romanov1-0/+0
No functional changes. Get ready for an increase in file number.
2020-09-10Fixing WebSocket frame retain function.Max Romanov1-2/+13
Some of the pointers were not adjusted after frame's memory re-allocation. Fortunately, this function was not used and the bug has no effect.
2020-09-07Upstream connection was not closed for short chunked response.Igor Sysoev1-27/+3
2020-08-28Vars: added $host.Valentin Bartenev1-0/+20
This closes #407 issue on GitHub.
2020-08-25Isolation: added "automount" option.Tiago Natel de Moura5-20/+98
Now it's possible to disable default bind mounts of languages by setting: { "isolation": { "automount": { "language_deps": false } } } In this case, the user is responsible to provide a "rootfs" containing the language libraries and required files for the application.
2020-08-25PHP: added bind mounts for extensions directory.Tiago Natel de Moura1-2/+4
2020-08-21Configuration: removed "reschedule_timeout" option.Valentin Bartenev3-18/+0
It's not used since cbcd76704c90. This option is a leftover from previous IPC between router and applications processes. It was never documented, though. Thanks to 洪志道 (Hong Zhi Dao).
2020-08-20Isolation: mount tmpfs by default.Tiago Natel de Moura5-66/+155
2020-08-20Moved isolation related code to "nxt_isolation.c".Tiago Natel de Moura6-980/+989
2020-08-19Configuration: improved error message of invalid listener address.Valentin Bartenev1-2/+9
Thanks to 洪志道 (Hong Zhi Dao). This closes #466 issue on GitHub.
2020-08-17Supporting platforms without sendfile() implementation.Max Romanov1-1/+18
This is a quick and dirty sendfile() replacement. This closes #452 PR on GitHub.
2020-08-17Style: changing preprocessor directives.Max Romanov1-5/+11
Using #if directives instead of #ifdef the same way as in other places.
2020-08-13Fixing router assertion in result of application prefork error.Max Romanov1-0/+8
Buffer for application prefork request allocated from temp conf mem_pool. If error response from main process received before buffer completion handler, temp conf mem_pool destroyed and router may crash in completion handler. Assertion "src/nxt_buf.c:208 assertion failed: data == b->parent" triggered when NXT_DEBUG_ALLOC enabled in configure. This patch disables completion handler and memory allocated for buffer released with memory pool.
2020-08-13Fixed error handling of prefork callback.Tiago Natel de Moura1-14/+21
Previously, an error during the prefork phase triggered assert: src/nxt_port.c:27 assertion failed: port->pair[0] == -1 and resulted in exiting of the main process. This could be easily reproduced by pushing a configuration with "rootfs", when daemon is running without required permissions.
2020-08-13Fixed typo in return value check.Valentin Bartenev1-1/+1
Found by Coverity (CID 361277).
2020-08-13Basic variables support.Valentin Bartenev18-144/+1084
2020-08-12PHP: compatibility with 8.0.0 Beta 1.Remi Collet1-1/+15
This closes #441 PR on GitHub.
2020-08-12Responding with error in case of first process start failure.Max Romanov3-18/+129
After shared application port introducing, request queue in router was removed and requests may stuck forever waiting for another process start.
2020-08-12Fixing issues found by static analyzer.Max Romanov1-2/+4
2020-08-11Fixing return value initialization.Max Romanov1-19/+25
2020-08-11Style fixes for 2 file descriptors transfer over port.Max Romanov7-110/+115
Two consecutive fd and fd2 fields replaced with array.
2020-08-11Moving file descriptor blocking to libunit.Max Romanov3-19/+39
The default libunit behavior relies on blocking the recv() call for port file descriptors, which an application may override if needed. For external applications, port file descriptors were toggled to blocking mode before the exec() call. If the exec() call failed, descriptor remained blocked, so the process hanged while trying to read from it. This patch moves file descriptor mode switch inside libunit.
2020-08-11Wrapping close() call in libunit for logging.Max Romanov1-35/+44
2020-08-11Introducing application and port shared memory queues.Max Romanov11-311/+1793
The goal is to minimize the number of syscalls needed to deliver a message.
2020-08-11Circular queues implementations and a test.Max Romanov3-0/+886
- naive circular queue, described in the article "A Scalable, Portable, and Memory-Efficient Lock-Free FIFO Queue" by Ruslan Nikolaev: https://drops.dagstuhl.de/opus/volltexte/2019/11335/pdf/LIPIcs-DISC-2019-28.pdf - circular queue, proposed by Valentin Bartenev in the "Unit router application IPC" design draft
2020-08-11Port message extended to transfer 2 file descriptors.Max Romanov5-27/+81
2020-08-11Made router port message handlers into static functions.Max Romanov2-10/+13
Mostly harmless.
2020-08-11Adding debug messages to catch process management issues.Max Romanov1-2/+36
2020-08-11Process structures refactoring in runtime and libunit.Max Romanov4-208/+93
Generic process-to-process shared memory exchange is no more required. Here, it is transformed into a router-to-application pattern. The outgoing shared memory segments collection is now the property of the application structure. The applications connect to the router only, and the process only needs to group the ports.
2020-08-11Introducing the shared application port.Max Romanov9-1226/+876
This is the port shared between all application processes which use it to pass requests for processing. Using it significantly simplifies the request processing code in the router. The drawback is 2 more file descriptors per each configured application and more complex libunit message wait/read code.
2020-08-11Changing router to application shared memory exchange protocol.Max Romanov8-179/+374
The application process needs to request the shared memory segment from the router instead of the latter pushing the segment before sending a request to the application. This is required to simplify the communication between the router and the application and to prepare the router for using the application shared port and then the queue.
2020-08-11Changing router to application port exchange protocol.Max Romanov7-97/+342
The application process needs to request the port from the router instead of the latter pushing the port before sending a request to the application. This is required to simplify the communication between the router and the application and to prepare the router to use the application shared port and then the queue.
2020-08-11Adding a reference counter to the libunit port structure.Max Romanov2-351/+340
The goal is to minimize the number of (pid, id) to port hash lookups which require a library mutex lock. The response port is found once per request, while the read port is initialized at startup.
2020-08-11Libunit refactoring: port management.Max Romanov7-330/+372
- Changed the port management callbacks to notifications, which e. g. avoids the need to call the libunit function - Added context and library instance reference counts for a safer resource release - Added the router main port initialization
2020-08-09Fixing leaked configuration objects.Max Romanov1-4/+30
If there are no listen sockets, the router configuration usage counter remains 0 and never decreases. The only moment to release a configuration is right after a configuration update.
2020-08-09Fixing connection remote sockaddr leakage.Max Romanov1-2/+4
Earlier patch 1bf971f83571 fixes connection leakage. But connection free requires separate remote sockaddr release.
2020-08-07Node.js: correct port data memory release.Max Romanov1-1/+15
According to libuv documentation, uv_poll_t memory should be released in a callback function passed to uv_close(). Otherwise, the Node.js application process may crash at exit.
2020-08-07Fixing listen event connection leakage.Max Romanov1-0/+4
A connection object is allocated in advance for each listen event object to be used for the established connection. This connection needs to be freed when the listen event is destroyed.
2020-08-05Improved mkstemp() error reporting.Valentin Bartenev1-1/+1
The invocation parameters should be logged as well, notably the path of the file that is failed to be created. Also, log level changed to ALERT as it's quite critical error.
2020-08-05Fixed nxt_conn_accept_alloc() behavior in low memory conditions.Valentin Bartenev1-5/+5
Earlier, if nxt_mp_create() failed to allocate memory while accepting a new connection, the resulting NULL was subsequently passed to nxt_mp_destroy(), crashing the process. More, if nxt_mp_create() was successful but nxt_sockaddr_cache_alloc() failed, the connection object wasn't destroyed properly, leaving the connection counter in an inconsistent state. Repeated, this condition lowered the connection capacity of the process and could eventually prevent it from accepting connections altogether.