Commit Graph

1684 Commits

Author SHA1 Message Date
Valentin Bartenev 63ff7a341a Added version 1.4 CHANGES. 2018-09-20 18:18:52 +03:00
Max Romanov 58c38298f5 Resetting init->stream for ready process.
Router requests application start by sending port message with application
parameters to master.  In response router gets application port.  Stream id
used to link request and response.  If application process terminates
unexpectedly (e.g. before ready state), it is required to notify router about
application start failure.  For this purpose stream id is stored in process
initialization parameters.

Stream id sequentially incremented and starts from 1 in case of router
resurrection.  New router application start stream id may coincide with
stream id of currently running/terminating application processes.  In such
cases router may receive REMOVE_PID message with same stream id as used in
application start request and mistakenly reports application start failure.

This commit tries to avoid such errors by resetting stream for processes in
ready state.
2018-09-20 17:30:56 +03:00
Andrey Zelenkov d0e428aace Tests: TLS tests. 2018-09-20 16:34:34 +03:00
Sergey Kandaurov e4650b7412 Fixed building perl on Alpine Linux.
_GNU_SOURCE is required there to expose off64_t and other types.
2018-09-20 16:34:19 +03:00
Max Romanov 9fe6e75d35 Preventing port from release in asynchronous operations.
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.
2018-09-20 16:16:32 +03:00
Andrei Belov fea05e3065 Packages: enabled OpenSSL support. 2018-09-20 16:14:29 +03:00
Valentin Bartenev 510c2e15c5 Python: adjusted input.read(size) argument value interpretation.
Previously, passing 0 resulted in reading the whole body and all negative
values raised an exception.

Now the behaviour is in consistentance with io.RawIOBase.read() interface,
and passing 0 returns empty (byte) string, while -1 results in reading the
whole body.
2018-09-20 16:04:49 +03:00
Max Romanov 9f29ac9f3e Preserving inherited engine memory pool in controller process.
The pool is inherited from master process since changeset 854a1a440616.
2018-09-20 15:50:48 +03:00
Valentin Bartenev a2eca97e89 Controller: addressing of array elements in requests. 2018-09-20 15:27:14 +03:00
Valentin Bartenev 8d844bc2aa Controller: certificates storage interface. 2018-09-20 15:27:08 +03:00
Valentin Bartenev 2dfd8ffc2f Deduplicated string value initializations. 2018-09-20 15:27:06 +03:00
Igor Sysoev b5d76454ed Added nginx error 497 response. 2018-09-20 15:05:38 +03:00
Igor Sysoev 96cd68b340 Added SSL/TLS support on connection level. 2018-09-20 15:05:37 +03:00
Max Romanov e964e982fd Initializing application structure with 0 to avoid crash.
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.
2018-09-19 19:24:56 +03:00
Max Romanov 5ef1352fae Initializing user_cred gids and ngroups for MacOS. 2018-09-19 18:53:16 +03:00
Valentin Bartenev 353db6f361 Fixed more typos.
Thanks to 洪志道 (Hong Zhi Dao).
2018-09-18 16:28:24 +03:00
Andrey Zelenkov 8065ba84aa Tests: test_settings_header_read_timeout_update adjusted. 2018-09-17 19:07:29 +03:00
Igor Sysoev 7458f66dda Fixed non-auto-reset timers. 2018-09-17 16:37:20 +03:00
Igor Sysoev 4bb4525031 Removed deprecated MacOSX OSSpinLockLock(). 2018-09-17 16:37:17 +03:00
Igor Sysoev 74b69f5e95 Fixed typo.
This closes #166 issue on GitHub.
Thanks to 洪志道 (Hong Zhi Dao).
2018-09-17 16:37:13 +03:00
Igor Sysoev ab5b67b45d Fixed typo.
This closes #165 issue on GitHub.
Thanks to 洪志道 (Hong Zhi Dao).
2018-09-17 16:37:11 +03:00
Valentin Bartenev 4bc7a23ecf Fixed spelling in a comment.
This closes #161 issue on GitHub.
Thanks to 洪志道 (Hong Zhi Dao).
2018-09-10 14:55:15 +03:00
Max Romanov 903ee2de64 Misspelled variable names fixed. 2018-09-07 18:45:14 +03:00
Andrey Zelenkov 511a0fa760 Tests: used relative path for configuration. 2018-09-06 20:18:33 +03:00
Andrey Zelenkov 58d23eb5b4 Tests: fixed test_settings_header_read_timeout_update. 2018-09-04 02:30:27 +03:00
Andrey Zelenkov 9f5349d347 Tests: "no_recv" option introduced. 2018-09-04 02:30:27 +03:00
Andrey Zelenkov 6bebbe3e8a Tests: "/config" prefix used. 2018-09-04 02:30:27 +03:00
Andrey Zelenkov dea7e0dc87 Tests: more timeout tests. 2018-08-21 20:49:23 +03:00
Andrey Zelenkov a4e75be524 Tests: typo. 2018-08-21 20:41:36 +03:00
Max Romanov ec1af82323 Stopping all application processes if router process dies.
Unit master process restarts the router if the router accidentally dies.
New router process receives the configuration from controller and starts
configured applications.  The information of running applications cannot
be transferred to router because currently there is no persistent application
identifier.  To avoid orphan application processes started by died router,
master process stops all currently running applications once it receives
SIGCHLD for router process.
2018-08-10 19:27:15 +03:00
Max Romanov 86740ab34b Introducing app joint to accurate app release.
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.
2018-08-10 19:27:13 +03:00
Valentin Bartenev 941616f893 Returning error for "make tests" when "--tests" wasn't configured. 2018-08-08 18:43:46 +03:00
Andrey Zelenkov 6c0c3dcaa7 Tests: simple "Transfer-Encoding" client header test. 2018-08-08 15:36:30 +03:00
Andrey Zelenkov eee6102a28 Tests: more reconfigure tests. 2018-08-08 15:30:05 +03:00
Alexander Borisov c67fbf01ad Perl: use of portable macro instead of an explicit declaration. 2018-08-08 15:04:43 +03:00
Max Romanov b2ec830515 Removing non-required warning. 2018-08-07 20:03:58 +03:00
Max Romanov 9015b8b25d Improved 'invalid file descriptor' diagnostic.
Unit router process may send mmap file decritptor to the application process
for further information exchange.  During this process there may be various
errors, which should be described in application error log.  If file descriptor
cannot be properly transferred with 'new mmap' message, fd variable will
be assigned to -1 and further syscalls using this file descriptor will fail.

For 'new port' message fd is checked in the same way.

This commit adds early 'invalid file descriptor' diagnostic and write
corresponding message to error log.

Found by Coverity (CID 308515).
2018-08-07 17:57:06 +03:00
Max Romanov 257283cc38 Fixed unit library mutex usage.
For the optimization purpose, function nxt_unit_remove_process() expects
lib->mutex to be locked.  The function then moves ports queue into temporary
queue and releases mutex.  In nxt_unit_done() there were two errors: mutex was
not locked before nxt_unit_remove_process() call and mutex was not destroyed.
It is hard to tell what was possible negative impact of this errors.

Found by Coverity (CID 308517).
2018-08-07 15:52:11 +03:00
Andrey Zelenkov 09268676ef Tests: remove unused function.
This function was accidentally added in e0f0cd7d244a.
2018-08-06 19:40:37 +03:00
Max Romanov b021188e95 Python: decoding unicode strings as Latin1.
According to PEP 3333, header names and values should be decoded as Latin1.
2018-08-06 19:16:45 +03:00
Max Romanov 1bb22d1e92 Unit application library.
Library now used in all language modules.
Old 'nxt_app_*' code removed.

See src/test/nxt_unit_app_test.c for usage sample.
2018-08-06 17:27:33 +03:00
Andrey Zelenkov b6ce2da65c Tests: expectedFailure removed from test_settings_idle_timeout.
Fix committed in f04b28aa6e02.
2018-07-30 20:07:31 +03:00
Igor Sysoev 8654372842 Fixed segfault on listening socket close.
Now keep-alive connection sends 408 response if listening
socket was closed while reconfiguration.
2018-07-30 17:05:49 +03:00
Igor Sysoev 69a1169cae Sending 408 response on idle connection timeout. 2018-07-30 17:05:48 +03:00
Andrey Zelenkov 7f57b6d984 Tests: fixed test_settings_idle_timeout. 2018-07-30 17:01:14 +03:00
Andrey Zelenkov a458f50d59 Tests: fixed header value char tests.
Use byte strings to avoid problems with encoding.
2018-07-30 16:40:52 +03:00
Valentin Bartenev 4b67de4bbb Removed implicit call of nxt_thread() in nxt_thread_tid().
Explicit is better than implicit © The Zen of Python.

The nxt_thread_tid(NULL) call was used only twice in the code
and such behaviour was specific to nxt_thread_tid() function.
2018-07-27 17:52:21 +03:00
Igor Sysoev 12c890c1ca Added OpenBSD 3.9 getthrid().
Prodded by David Carlier.
2018-07-27 16:57:45 +03:00
Igor Sysoev 7e41f9d108 Refactored thread ID functions.
nxt_thread_tid() was moved to src/nxt_thread.c
nxt_thread_get_tid() was moved to src/nxt_thread_id.h.
src/nxt_thread_id.c was removed.
2018-07-27 16:53:26 +03:00
Valentin Bartenev de885e10cb Fixed configure process with non-default locale.
Overriding LANG might not work, since it has less precedence than LC_* settings.
LC_ALL has the highest precedence.

This should resolve issue #121 on GitHub.
2018-07-23 19:21:33 +03:00