History log of /unit/src/nxt_runtime.c (Results 1 – 25 of 92)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 2207:c69f96ca4d5e 06-Aug-2022 Andrew Clayton

Socket: Created control socket & pid file directories.

@alejandro-colomar reported an issue on GitHub whereby Unit would fail
to start due to not being able to create the control socket (a Unix
Doma

Socket: Created control socket & pid file directories.

@alejandro-colomar reported an issue on GitHub whereby Unit would fail
to start due to not being able to create the control socket (a Unix
Domain Socket)

2022/08/05 20:12:22 [alert] 21613#21613 bind(6,
unix:/opt/local/unit/var/run/unit/control.unit.sock.tmp)
failed (2: No such file or directory)

This could happen if the control socket was set to a directory that
doesn't exist. A common place to put the control socket would be under
/run/unit, and while /run will exist, /run/unit may well not (/run
is/should be cleared on each boot).

The pid file would also generally go under /run/unit, though this is
created after the control socket, however it could go someplace else so
we should also ensure its directory exists.

This commit will try to create the pid file and control sockets parent
directory. In some cases the user will need to ensure that the rest of
the path already exists.

This adds a new nxt_fs_mkdir_parent() function that given a full path
to a file (or directory), strips the last component off before passing
the remaining directory path to nxt_fs_mkdir().

Cc: Konstantin Pavlov <thresh@nginx.com>
Closes: <https://github.com/nginx/unit/issues/742>
Reported-by: Alejandro Colomar <alx@nginx.com>
Reviewed-by: Alejandro Colomar <alx@nginx.com>
Tested-by: Alejandro Colomar <alx@nginx.com>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>

show more ...


Revision tags: 1.28.0-1, 1.28.0
# 2174:a7fb5d8a9590 17-Feb-2022 Max Romanov

Fixing isolated process PID manipulation.

Registering an isolated PID in the global PID hash is wrong
because it can be duplicated. Isolated processes are stored only
in the children list until the

Fixing isolated process PID manipulation.

Registering an isolated PID in the global PID hash is wrong
because it can be duplicated. Isolated processes are stored only
in the children list until the response for the WHOAMI message is
processed and the global PID is discovered.

To remove isolated siblings, a pointer to the children list is
introduced in the nxt_process_init_t struct.

This closes #633 issue on GitHub.

show more ...


Revision tags: 1.27.0-1, 1.27.0, 1.26.1-1, 1.26.1, 1.26.0-1, 1.26.0
# 1998:c8790d2a89bb 09-Nov-2021 Tiago Natel de Moura

Introducing application prototype processes.


# 1997:a8a3f1d243ee 09-Nov-2021 Tiago Natel de Moura

Changed nxt_process_* for reuse.

This enables the reuse of process creation functions.


# 1969:be6409cdb028 09-Oct-2021 Zhidao HONG

Configuration: automatic migration to the new "share" behavior.


Revision tags: 1.25.0-1, 1.25.0, 1.24.0-1, 1.24.0, 1.23.0-1, 1.23.0, 1.22.0-1, 1.22.0
# 1781:e1f459d7469b 28-Jan-2021 Max Romanov

Removing unused mutex from nxt_process_t.


Revision tags: 1.21.0-1, 1.21.0
# 1721:53b6ab9b324b 17-Nov-2020 Axel Duch

Router: matching regular expressions support.


Revision tags: 1.20.0-1, 1.20.0
# 1580:f1aefdf995d4 20-Aug-2020 Tiago Natel de Moura

Isolation: mount tmpfs by default.


Revision tags: 1.19.0-1, 1.19.0
# 1563:d32bc428f46b 12-Aug-2020 Valentin Bartenev

Basic variables support.


# 1548:a745db447e56 11-Aug-2020 Max Romanov

Process structures refactoring in runtime and libunit.

Generic process-to-process shared memory exchange is no more required. Here,
it is transformed into a router-to-application pattern. The outg

Process structures refactoring in runtime and libunit.

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.

show more ...


# 1545:78836321a126 11-Aug-2020 Max Romanov

Changing router to application port exchange protocol.

The application process needs to request the port from the router instead of the
latter pushing the port before sending a request to the applic

Changing router to application port exchange protocol.

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.

show more ...


# 1520:ef3db0408f7c 23-Jul-2020 Max Romanov

Fixing various router crashes on exit caused by runtime pool free.

Currently, the router exits without waiting for the worker threads to stop.
There is a short gap between the runtime memory pool's

Fixing various router crashes on exit caused by runtime pool free.

Currently, the router exits without waiting for the worker threads to stop.
There is a short gap between the runtime memory pool's free and the exit, during
which a worker thread may try to access a runtime structure. In turn, this may
cause a crash. For now, it is better to keep this memory allocated.

show more ...


Revision tags: 1.18.0-1, 1.18.0
# 1489:4a3ec07f4b19 28-May-2020 Tiago Natel de Moura

Added "rootfs" feature.


# 1488:6976d36be926 09-Mar-2020 Tiago Natel de Moura

Refactor of process management.

The process abstraction has changed to:

setup(task, process)
start(task, process_data)
prefork(task, process, mp)

The prefork() occurs in the main process rig

Refactor of process management.

The process abstraction has changed to:

setup(task, process)
start(task, process_data)
prefork(task, process, mp)

The prefork() occurs in the main process right before fork.

The file src/nxt_main_process.c is completely free of process
specific logic.

The creation of a process now supports a PROCESS_CREATED state. The
The setup() function of each process can set its state to either
created or ready. If created, a MSG_PROCESS_CREATED is sent to main
process, where external setup can be done (required for rootfs under
container).

The core processes (discovery, controller and router) doesn't need
external setup, then they all proceeds to their start() function
straight away.

In the case of applications, the load of the module happens at the
process setup() time and The module's init() function has changed
to be the start() of the process.

The module API has changed to:

setup(task, process, conf)
start(task, data)

As a direct benefit of the PROCESS_CREATED message, the clone(2) of
processes using pid namespaces now doesn't need to create a pipe
to make the child block until parent setup uid/gid mappings nor it
needs to receive the child pid.

show more ...


# 1487:6238e2224c43 27-May-2020 Max Romanov

Moving nxt_stream_ident to shared memory.

This aims to avoid stream id clashes after router restart.


Revision tags: 1.17.0-1, 1.17.0
# 1451:0a8840921fd0 08-Apr-2020 Valentin Bartenev

Controller: improved handling of unix domain control socket.

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

Controller: improved handling of unix domain control socket.

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.

show more ...


# 1449:8bcb79f5d69d 08-Apr-2020 Valentin Bartenev

Removed unused code related to testing of address binding.


Revision tags: 1.16.0-1, 1.16.0
# 1403:1cee885b7f10 12-Mar-2020 Max Romanov

Using disk file to store large request body.

This closes #386 on GitHub.


Revision tags: 1.15.0-1, 1.15.0, 1.14.0-1, 1.14.0
# 1305:966d691dab2c 06-Dec-2019 Tiago Natel

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
struc

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.

show more ...


# 1302:d4c6a91f7091 26-Nov-2019 Tiago Natel

Refactor of process init.

Introduces the functions nxt_process_init_create() and
nxt_process_init_creds_set().


Revision tags: 1.13.0-1, 1.13.0
# 1254:aae6699f4eee 29-Oct-2019 Hong Zhi Dao

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_p

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.

show more ...


# 1253:b225cd619dbb 29-Oct-2019 Max Romanov

Allocating process init struct from runtime memory pool.

This avoids memory leak reports from the address sanitizer.


# 1251:5ce938471a4e 28-Oct-2019 Tiago Natel

Releasing the memory of removed thread pools at exit.


# 1238:2da0e59ed1f5 22-Oct-2019 Max Romanov

Fixing idle connection close function.

There was a typo: nxt_queue_head() used instead of nxt_queue_first() in
connection iteration loop. This prevents idle connection close on quit.

This closes #

Fixing idle connection close function.

There was a typo: nxt_queue_head() used instead of nxt_queue_first() in
connection iteration loop. This prevents idle connection close on quit.

This closes #334 issue on GitHub.
Thanks to 洪志道 (Hong Zhi Dao).

show more ...


Revision tags: 1.12.0-1, 1.12.0, 1.11.0-2, 1.11.0-1, 1.11.0
# 1182:325b315e48c4 19-Sep-2019 Tiago de Bem Natel de Moura

Initial applications isolation support using Linux namespaces.


1234