diff options
author | Max Romanov <max.romanov@nginx.com> | 2019-09-18 18:31:22 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2019-09-18 18:31:22 +0300 |
commit | a216b15e991d6e7cdc7b61fe018d58dd387937bd (patch) | |
tree | 72c429920f804ee9dff9afee4efa010f52a5b158 /src/nxt_main.c | |
parent | 84e4a6437f69b14b1cafbe7915447fdcf1d87f68 (diff) | |
download | unit-a216b15e991d6e7cdc7b61fe018d58dd387937bd.tar.gz unit-a216b15e991d6e7cdc7b61fe018d58dd387937bd.tar.bz2 |
Fixing request release order to avoid crashes on exit.
Each request references the router process structure that owns all memory
maps. The process structure has a reference counter; each request increases
the counter to lock the structure in memory until request processing ends.
Incoming and outgoing buffers reference memory maps that the process owns,
so the process structure should be released only when all buffers are
released to avoid invalid memory access and a crash.
This describes the libunit library mechanism used for application processes.
The background of this issue is as follows:
The issue was found on buildbot when the router crashed during Java
websocket tests. The Java application receives a notification from the
master process; when the notification is processed, libunit deletes the
process structure from its process hash and decrements the use counter;
however, active websocket connections maintain their use counts on the
process structure. After that, when the master process is stopping the
application, libunit releases active websocket connections. At this point,
it's important to release the connections' memory buffers before the
corresponding process structure and all shared memory segments are released.
Diffstat (limited to 'src/nxt_main.c')
0 files changed, 0 insertions, 0 deletions