Commit Graph

61 Commits

Author SHA1 Message Date
Tiago Natel
ed2492a66a Moved credential-related code to nxt_credential.c.
This is required to avoid include cycles, as some nxt_clone_* functions
depend on the credential structures, but nxt_process depends on clone
structures.
2019-12-06 13:28:05 +00:00
Tiago Natel
417cc7be7c Refactor of process init.
Introduces the functions nxt_process_init_create() and
nxt_process_init_creds_set().
2019-11-26 16:26:24 +00:00
Hong Zhi Dao
5d42599e33 Process port refactoring.
- Introduced nxt_runtime_process_port_create().
- Moved nxt_process_use() into nxt_process.c from nxt_runtime.c.
- Renamed nxt_runtime_process_remove_pid() as nxt_runtime_process_remove().
- Some public functions transformed to static.

This closes #327 issue on GitHub.
2019-10-29 16:07:21 +03:00
Max Romanov
65b03a14a7 Allocating process init struct from runtime memory pool.
This avoids memory leak reports from the address sanitizer.
2019-10-29 15:33:45 +03:00
Tiago Natel
0beb8ea5e1 Fixed passing false in namespace flags.
This patch closes #328 in github.
2019-10-11 10:00:06 +00:00
Igor Sysoev
09e7357b08 Style fixes. 2019-10-10 19:42:41 +03:00
Max Romanov
f2b280aa0c Fixed exiting if a signal arrives during discovery.
When Unit starts, the main process waits for module discovery message for a
while.  If a QUIT signal arrives at this time, the router and controller
processes created by main and Unit stay running.  Also, the main process
doesn't stop them after the second QUIT signal is received in this case.
2019-09-30 16:39:08 +03:00
Tiago Natel
93ead87810 Removed linux/sched.h include.
The <sched.h> is already included by nxt_unix.h.

This closes #314 PR on GitHub.
2019-09-20 13:08:04 +00:00
Tiago Natel
20628c74fa Releasing init struct in case of errors.
Found by Coverity (CID 349485).
2019-09-20 13:12:04 +00:00
Tiago de Bem Natel de Moura
c554941b4f Initial applications isolation support using Linux namespaces. 2019-09-19 15:25:23 +03:00
Max Romanov
1fac43eebe Fixing master process crash after failed fork.
This closes #312 issue on GitHub.
2019-09-18 22:45:30 +03:00
Andrey Zelenkov
22de5fcddf Style. 2019-03-11 17:31:59 +03:00
Max Romanov
5bfdebb9e4 Introducing Java Servlet Container beta. 2019-02-28 18:02:42 +03:00
Igor Sysoev
acb5b0aad7 Ignoring HUP signal in main process. 2019-02-18 18:34:20 +03:00
Igor Sysoev
fd6a6a5514 Fixed processing Unix listening socket failures.
This is related to issue #198 on GitHub.
2019-01-21 18:39:19 +03:00
Valentin Bartenev
029c1a9f50 Renamed "go" application type to "external".
There's nothing specific to Go language.  This type of application object can
be used to run any external application that utilizes libunit API.
2018-10-09 17:53:31 +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
Valentin Bartenev
8d844bc2aa Controller: certificates storage interface. 2018-09-20 15:27:08 +03:00
Max Romanov
903ee2de64 Misspelled variable names fixed. 2018-09-07 18:45:14 +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
Igor Sysoev
3ad1acca12 Fixed exit status on start failure.
This and previous commit close #131 issue on GitHub.
2018-06-18 17:14:32 +03:00
Igor Sysoev
cb36b07686 Removing Unix control socket on start failure.
The bug had appeared in 5cc5002a788e when process type has been
converted to bitmask. This commit reverts the type back to a number.

This commit is related to #131 issue on GitHub.
2018-06-18 17:14:30 +03:00
Valentin Bartenev
388390888b PHP: added setting of php.ini configuration file path. 2018-06-07 16:17:31 +03:00
Valentin Bartenev
ceeb301881 Go: specifying command line arguments to the executable.
This closes #110 issue on GitHub.
2018-06-06 16:53:35 +03:00
Igor Sysoev
d3356f7ad2 Added version number to main process title. 2018-05-29 19:51:27 +03:00
Valentin Bartenev
d7e6e2bd8c Configuration of environment variables for application processes. 2018-05-28 20:55:23 +03:00
Valentin Bartenev
da61cfd98b Access log reopening. 2018-04-11 18:23:58 +03:00
Valentin Bartenev
204c394721 Initial access log support. 2018-04-11 18:23:33 +03:00
Alexander Borisov
37051b6c15 Added Ruby support. 2018-03-21 16:50:07 +03:00
Valentin Bartenev
912a49c609 Reduced number of critical log levels. 2018-03-05 17:32:50 +03:00
Max Romanov
babf67712e Removed unwanted assertions. 2018-02-20 19:00:30 +03:00
Valentin Bartenev
27b00629e1 Fixed race condition while discovering modules.
Previously, the discovery process might exit before the main process
received a list of available modules.
2018-02-14 16:33:35 +03:00
Max Romanov
18c66cb07d Improving configuration field mapping names.
Avoiding word 'common' as too common.
Couple of assertions reduced to error messages.
2018-02-13 21:28:21 +03:00
Valentin Bartenev
9d683d37b1 Fixed starting of applications with specified version.
The "type" option can contain version number that need to be cut off before
calling nxt_app_parse_type().

The bug was introduced in 4979fe09d9cd.
2018-02-09 19:06:53 +03:00
Max Romanov
f7195e7016 Fixed typo in assertion statement introduced in 4979fe09d9cd.
Found by Coverity (CID 260375).
2018-02-02 14:08:18 +03:00
Alexander Borisov
960962ddce Added Perl support. 2018-01-31 15:47:00 +03:00
Max Romanov
9cd4fdbdb7 Introducing extended app process management.
- Pre-fork 'processes.spare' application processes;
- fork more processes to keep 'processes.spare' idle processes;
- fork on-demand up to 'processes.max' count;
- scale down idle application processes above 'processes.spare' after
  'processes.idle_timeout';
- number of concurrently started application processes also limited by
  'processes.spare' (or 1, if spare is 0).
2018-01-29 16:17:36 +03:00
Sergey Kandaurov
771e9d3cc3 Fixed formatting in nxt_sprintf() and logging. 2018-01-24 15:16:33 +03:00
Sergey Kandaurov
67c64a99fb Using size_t for the field width type of the "%*s" specifier. 2018-01-24 15:16:32 +03:00
Max Romanov
349717fb90 Changing relative php scripts paths to real ones.
This is required to run phpMyAdmin.
2018-01-11 22:14:20 +03:00
Igor Sysoev
dbd7540a04 Removed duplicate declaration. 2017-12-28 20:50:49 +03:00
Max Romanov
3781950bad Introducing python virtualenv configuration.
New parameter 'home' for python application allows to configure
application-specific virtualenv path.

This closes #15 issue on GitHub.
2017-11-29 18:48:55 +03:00
Max Romanov
6bbed85899 Fixing Coverity warnings.
CID 200496
CID 200494
CID 200490
CID 200489
CID 200483
CID 200482
CID 200472
CID 200465
2017-11-20 17:08:29 +03:00
Valentin Bartenev
e7d81186b5 Fixed controller restarting.
Previously, stored configuration wasn't reread on controller
process restart, which resulted in segmentation fault.
2017-10-19 17:43:54 +03:00
Max Romanov
b3aab8c66f Filtering process to keep connection.
- Main process should be connected to all other processes.
- Controller should be connected to Router.
- Router should be connected to Controller and all Workers.
- Workers should be connected to Router worker thread ports only.

This filtering helps to avoid unnecessary communication and various errors
during massive application workers stop / restart.
2017-10-19 17:37:19 +03:00
Valentin Bartenev
e4bea2c75c Optimized application type handling. 2017-10-10 19:15:08 +03:00
Valentin Bartenev
096562c0b1 Improved applications versions handling. 2017-10-05 16:46:18 +03:00
Max Romanov
00ecf713e3 Port message fragmentation supported.
- Each sendmsg() transmits no more than port->max_size payload data.
- Longer buffers are fragmented and send using multiple sendmsg() calls.
- On receive side, buffers are connected in chain.
- Number of handler calls is the same as number of nxt_port_socket_write()
  calls.
- nxt_buf_make_plain() function introduced to make single plain buffer from
  the chain.
2017-10-04 15:03:45 +03:00
Max Romanov
e44401a0bb Introducing process use counter.
This helps to decouple process removal from port memory pool cleanups.
2017-10-04 15:02:11 +03:00
Max Romanov
6a64533fa3 Introducing use counters for port and app. Thread safe port write.
Use counter helps to simplify logic around port and application free.

Port 'post' function introduced to simplify post execution of particular
function to original port engine's thread.

Write message queue is protected by mutex which makes port write operation
thread safe.
2017-10-04 14:58:47 +03:00