From f30f8f06c9d4f5f3bdc1ac53e1defb34ab0b7ae7 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Thu, 2 Dec 2021 17:16:05 +0300 Subject: [PATCH 01/19] Version bump. --- docs/changes.xml | 29 +++++++++++++++++++++++++++++ version | 4 ++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/docs/changes.xml b/docs/changes.xml index df0b88c9..a40d87bb 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -5,6 +5,35 @@ + + + + +NGINX Unit updated to 1.26.1. + + + + + + + + + + + diff --git a/version b/version index b890433f..77ca3d3f 100644 --- a/version +++ b/version @@ -1,5 +1,5 @@ # Copyright (C) NGINX, Inc. -NXT_VERSION=1.26.0 -NXT_VERNUM=12600 +NXT_VERSION=1.26.1 +NXT_VERNUM=12601 From 62d173f7af34eb3c6323e8c8aac15e20498c1785 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Tue, 23 Nov 2021 15:36:24 +0300 Subject: [PATCH 02/19] Fixed possible access to an uninitialized field. The "recv_msg.incoming_buf" is checked after jumping to the "done" label if nxt_socket_msg_oob_get_fds() returns an error. Also moved initialization of "port_msg" near to its first usage. Found by Coverity (CID 373899). --- src/nxt_unit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nxt_unit.c b/src/nxt_unit.c index 06ad1636..135c06ed 100644 --- a/src/nxt_unit.c +++ b/src/nxt_unit.c @@ -937,9 +937,9 @@ nxt_unit_process_msg(nxt_unit_ctx_t *ctx, nxt_unit_read_buf_t *rbuf, lib = nxt_container_of(ctx->unit, nxt_unit_impl_t, unit); + recv_msg.incoming_buf = NULL; recv_msg.fd[0] = -1; recv_msg.fd[1] = -1; - port_msg = (nxt_port_msg_t *) rbuf->buf; rc = nxt_socket_msg_oob_get_fds(&rbuf->oob, recv_msg.fd); if (nxt_slow_path(rc != NXT_OK)) { @@ -948,8 +948,6 @@ nxt_unit_process_msg(nxt_unit_ctx_t *ctx, nxt_unit_read_buf_t *rbuf, goto done; } - recv_msg.incoming_buf = NULL; - if (nxt_slow_path(rbuf->size < (ssize_t) sizeof(nxt_port_msg_t))) { if (nxt_slow_path(rbuf->size == 0)) { nxt_unit_debug(ctx, "read port closed"); @@ -965,6 +963,8 @@ nxt_unit_process_msg(nxt_unit_ctx_t *ctx, nxt_unit_read_buf_t *rbuf, goto done; } + port_msg = (nxt_port_msg_t *) rbuf->buf; + nxt_unit_debug(ctx, "#%"PRIu32": process message %d fd[0] %d fd[1] %d", port_msg->stream, (int) port_msg->type, recv_msg.fd[0], recv_msg.fd[1]); From c33c2925d91510e1c059a1581aad6dd959817191 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Wed, 24 Nov 2021 13:11:48 +0300 Subject: [PATCH 03/19] Fixing alerts on router restart. Splitting the process type connectivity matrix to 'keep ports' and 'send ports'; the 'keep ports' matrix is used to clean up unnecessary ports after forking a new process, and the 'send ports' matrix determines which process types expect to get created process ports. Unfortunately, the original single connectivity matrix no longer works because of an application stop delay caused by prototypes. Existing applications should not get the new router port at the moment. --- src/nxt_port.c | 2 +- src/nxt_process.c | 15 ++++++++++++--- src/nxt_process.h | 6 +++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/nxt_port.c b/src/nxt_port.c index 1e8fa28a..a5b64695 100644 --- a/src/nxt_port.c +++ b/src/nxt_port.c @@ -216,7 +216,7 @@ nxt_port_send_new_port(nxt_task_t *task, nxt_runtime_t *rt, port = nxt_process_port_first(process); - if (nxt_proc_conn_matrix[port->type][new_port->type]) { + if (nxt_proc_send_matrix[port->type][new_port->type]) { (void) nxt_port_send_port(task, port, new_port, stream); } diff --git a/src/nxt_process.c b/src/nxt_process.c index fca197eb..82e66a99 100644 --- a/src/nxt_process.c +++ b/src/nxt_process.c @@ -58,7 +58,7 @@ nxt_uid_t nxt_euid; /* A cached process effective gid */ nxt_gid_t nxt_egid; -nxt_bool_t nxt_proc_conn_matrix[NXT_PROCESS_MAX][NXT_PROCESS_MAX] = { +uint8_t nxt_proc_keep_matrix[NXT_PROCESS_MAX][NXT_PROCESS_MAX] = { { 1, 1, 1, 1, 1, 1 }, { 1, 0, 0, 0, 0, 0 }, { 1, 0, 0, 1, 0, 0 }, @@ -67,7 +67,16 @@ nxt_bool_t nxt_proc_conn_matrix[NXT_PROCESS_MAX][NXT_PROCESS_MAX] = { { 1, 0, 0, 1, 0, 0 }, }; -nxt_bool_t nxt_proc_remove_notify_matrix[NXT_PROCESS_MAX][NXT_PROCESS_MAX] = { +uint8_t nxt_proc_send_matrix[NXT_PROCESS_MAX][NXT_PROCESS_MAX] = { + { 1, 1, 1, 1, 1, 1 }, + { 1, 0, 0, 0, 0, 0 }, + { 1, 0, 0, 1, 0, 0 }, + { 1, 0, 1, 1, 1, 1 }, + { 1, 0, 0, 0, 0, 0 }, + { 1, 0, 0, 0, 0, 0 }, +}; + +uint8_t nxt_proc_remove_notify_matrix[NXT_PROCESS_MAX][NXT_PROCESS_MAX] = { { 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 1, 0, 0 }, @@ -265,7 +274,7 @@ nxt_process_child_fixup(nxt_task_t *task, nxt_process_t *process) /* Remove not ready processes. */ nxt_runtime_process_each(rt, p) { - if (nxt_proc_conn_matrix[ptype][nxt_process_type(p)] == 0 + if (nxt_proc_keep_matrix[ptype][nxt_process_type(p)] == 0 && p->pid != nxt_ppid) /* Always keep parent's port. */ { nxt_debug(task, "remove not required process %PI", p->pid); diff --git a/src/nxt_process.h b/src/nxt_process.h index c92eebd8..694f457e 100644 --- a/src/nxt_process.h +++ b/src/nxt_process.h @@ -151,9 +151,9 @@ typedef struct { } nxt_process_init_t; -extern nxt_bool_t nxt_proc_conn_matrix[NXT_PROCESS_MAX][NXT_PROCESS_MAX]; -extern nxt_bool_t - nxt_proc_remove_notify_matrix[NXT_PROCESS_MAX][NXT_PROCESS_MAX]; +extern uint8_t nxt_proc_keep_matrix[NXT_PROCESS_MAX][NXT_PROCESS_MAX]; +extern uint8_t nxt_proc_send_matrix[NXT_PROCESS_MAX][NXT_PROCESS_MAX]; +extern uint8_t nxt_proc_remove_notify_matrix[NXT_PROCESS_MAX][NXT_PROCESS_MAX]; NXT_EXPORT nxt_pid_t nxt_process_execute(nxt_task_t *task, char *name, char **argv, char **envp); From aaa34e0a644912e49d7c5619749b67f585da9c85 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Wed, 24 Nov 2021 13:11:50 +0300 Subject: [PATCH 04/19] Fixing zombie process appearance and hang up on shutdown. After the c8790d2a89bb commit, the SIGCHLD handler may return before processing all awaiting PIDs. To avoid zombie processes and ensure successful main process termination, waitpid() must be called until an error is returned. This closes #600 issue on GitHub. --- src/nxt_main_process.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c index a5a20d3d..61521854 100644 --- a/src/nxt_main_process.c +++ b/src/nxt_main_process.c @@ -950,9 +950,11 @@ nxt_main_process_sigchld_handler(nxt_task_t *task, void *obj, void *data) if (rt->nprocesses <= 1) { nxt_runtime_quit(task, 0); + + return; } - return; + continue; } nxt_port_remove_notify_others(task, process); From 1c0436d644c3a313096cd7d43c4148151c2193ee Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Thu, 25 Nov 2021 16:58:43 +0300 Subject: [PATCH 05/19] Fixing access_log structure reference counting. The reference to the access_log structure is stored in the current nxt_router_conf_t and the global nxt_router_t. When the reference is copied, the reference counter should be adjusted accordingly. This closes #593 issue on GitHub. --- docs/changes.xml | 7 +++++++ src/nxt_router.c | 30 ++++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/docs/changes.xml b/docs/changes.xml index a40d87bb..80477889 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -31,6 +31,13 @@ NGINX Unit updated to 1.26.1. date="" time="" packager="Andrei Belov <defan@nginx.com>"> + + +the router process crash on reconfiguration if "access_log" was configured +without listeners. + + + diff --git a/src/nxt_router.c b/src/nxt_router.c index 7623ccbb..85556a72 100644 --- a/src/nxt_router.c +++ b/src/nxt_router.c @@ -210,6 +210,8 @@ static void nxt_router_access_log_ready(nxt_task_t *task, nxt_port_recv_msg_t *msg, void *data); static void nxt_router_access_log_error(nxt_task_t *task, nxt_port_recv_msg_t *msg, void *data); +static void nxt_router_access_log_use(nxt_thread_spinlock_t *lock, + nxt_router_access_log_t *access_log); static void nxt_router_access_log_release(nxt_task_t *task, nxt_thread_spinlock_t *lock, nxt_router_access_log_t *access_log); static void nxt_router_access_log_reopen_completion(nxt_task_t *task, void *obj, @@ -1149,7 +1151,13 @@ nxt_router_conf_apply(nxt_task_t *task, void *obj, void *data) nxt_queue_add(&router->sockets, &updating_sockets); nxt_queue_add(&router->sockets, &creating_sockets); - router->access_log = rtcf->access_log; + if (router->access_log != rtcf->access_log) { + nxt_router_access_log_use(&router->lock, rtcf->access_log); + + nxt_router_access_log_release(task, &router->lock, router->access_log); + + router->access_log = rtcf->access_log; + } nxt_router_conf_ready(task, tmcf); @@ -1971,9 +1979,7 @@ nxt_router_conf_create(nxt_task_t *task, nxt_router_temp_conf_t *tmcf, access_log = router->access_log; if (access_log != NULL && nxt_strstr_eq(&path, &access_log->path)) { - nxt_thread_spin_lock(&router->lock); - access_log->count++; - nxt_thread_spin_unlock(&router->lock); + nxt_router_access_log_use(&router->lock, access_log); } else { access_log = nxt_malloc(sizeof(nxt_router_access_log_t) @@ -3922,6 +3928,22 @@ nxt_router_access_log_error(nxt_task_t *task, nxt_port_recv_msg_t *msg, } +static void +nxt_router_access_log_use(nxt_thread_spinlock_t *lock, + nxt_router_access_log_t *access_log) +{ + if (access_log == NULL) { + return; + } + + nxt_thread_spin_lock(lock); + + access_log->count++; + + nxt_thread_spin_unlock(lock); +} + + static void nxt_router_access_log_release(nxt_task_t *task, nxt_thread_spinlock_t *lock, nxt_router_access_log_t *access_log) From 7ed38c9efe97529784c65e2b25e440b817d364bb Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Thu, 25 Nov 2021 16:58:45 +0300 Subject: [PATCH 06/19] Added a changelog for 730e903f4534. --- docs/changes.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/changes.xml b/docs/changes.xml index 80477889..e1ad0434 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -38,6 +38,13 @@ without listeners. + + +occasionally, the Unit daemon was unable to fully terminate; the bug had +appeared in 1.26.0. + + + From d4b13c7cd5520b2b8bd8833765a3ba4246a93df7 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Thu, 25 Nov 2021 19:58:54 +0300 Subject: [PATCH 07/19] PHP: fixed crash when calling module functions in OPcache preload. In PHP, custom fastcgi_finish_request() and overloaded chdir() functions can be invoked by an OPcache preloading script (it runs when php_module_startup() is called in the app process setup handler). In this case, there was no runtime context set so trying to access it caused a segmentation fault. This closes #602 issue on GitHub. --- docs/changes.xml | 7 +++++++ src/nxt_php_sapi.c | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/changes.xml b/docs/changes.xml index e1ad0434..ba86da5e 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -45,6 +45,13 @@ appeared in 1.26.0. + + +a segmentation fault occurred in the PHP module if chdir() or +fastcgi_finish_request() was called in the OPcache preloading script. + + + diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c index ea5f5581..68ef07eb 100644 --- a/src/nxt_php_sapi.c +++ b/src/nxt_php_sapi.c @@ -204,7 +204,10 @@ ZEND_NAMED_FUNCTION(nxt_php_chdir) nxt_php_run_ctx_t *ctx; ctx = SG(server_context); - ctx->chdir = 1; + + if (nxt_fast_path(ctx != NULL)) { + ctx->chdir = 1; + } nxt_php_chdir_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); } @@ -225,7 +228,7 @@ PHP_FUNCTION(fastcgi_finish_request) ctx = SG(server_context); - if (nxt_slow_path(ctx->req == NULL)) { + if (nxt_slow_path(ctx == NULL || ctx->req == NULL)) { RETURN_FALSE; } From bc4968d1d781bb91ec54d80bce0f4c82f0c4cc23 Mon Sep 17 00:00:00 2001 From: Andrei Belov Date: Wed, 1 Dec 2021 09:01:52 +0300 Subject: [PATCH 08/19] Packages: adjusted debhelper minimal version for Debian/Ubuntu. Forgotten in 199a11eceb3c. While here, Standards-Version increased to 4.1.4 (matches Ubuntu 18.04 as the oldest supported distro). --- pkg/deb/debian.module/control-noarch.in | 4 ++-- pkg/deb/debian.module/control.in | 4 ++-- pkg/deb/debian/control.in | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/deb/debian.module/control-noarch.in b/pkg/deb/debian.module/control-noarch.in index d9d9e5e1..323377d9 100644 --- a/pkg/deb/debian.module/control-noarch.in +++ b/pkg/deb/debian.module/control-noarch.in @@ -2,9 +2,9 @@ Source: %%NAME%% Section: admin Priority: extra Maintainer: %%PACKAGE_VENDOR%% -Build-Depends: debhelper (>= 9), +Build-Depends: debhelper (>= 11), linux-libc-dev%%MODULE_BUILD_DEPENDS%% -Standards-Version: 3.9.5 +Standards-Version: 4.1.4 Homepage: https://unit.nginx.org Package: %%NAME%% diff --git a/pkg/deb/debian.module/control.in b/pkg/deb/debian.module/control.in index 9a6fa797..f5ce8ae4 100644 --- a/pkg/deb/debian.module/control.in +++ b/pkg/deb/debian.module/control.in @@ -2,11 +2,11 @@ Source: %%NAME%% Section: admin Priority: extra Maintainer: %%PACKAGE_VENDOR%% -Build-Depends: debhelper (>= 9), +Build-Depends: debhelper (>= 11), linux-libc-dev, libssl-dev, libpcre2-dev%%MODULE_BUILD_DEPENDS%% -Standards-Version: 3.9.5 +Standards-Version: 4.1.4 Homepage: https://unit.nginx.org Package: %%NAME%% diff --git a/pkg/deb/debian/control.in b/pkg/deb/debian/control.in index 4d59520e..691bafed 100644 --- a/pkg/deb/debian/control.in +++ b/pkg/deb/debian/control.in @@ -2,11 +2,11 @@ Source: unit Section: admin Priority: extra Maintainer: %%PACKAGE_VENDOR%% -Build-Depends: debhelper (>= 9), +Build-Depends: debhelper (>= 11), linux-libc-dev, libssl-dev, libpcre2-dev -Standards-Version: 3.9.5 +Standards-Version: 4.1.4 Homepage: https://unit.nginx.org Package: unit From 380f2dc2bae72f259ed3c7dc11b4c52a3eb4c06b Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov Date: Tue, 30 Nov 2021 17:00:47 +0300 Subject: [PATCH 09/19] Docker: respect the binary from CMD in the entrypoint. --- pkg/docker/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/docker/docker-entrypoint.sh b/pkg/docker/docker-entrypoint.sh index f455a958..59529925 100755 --- a/pkg/docker/docker-entrypoint.sh +++ b/pkg/docker/docker-entrypoint.sh @@ -24,7 +24,7 @@ if [ "$1" = "unitd" -o "$1" = "unitd-debug" ]; then else if /usr/bin/find "/docker-entrypoint.d/" -mindepth 1 -print -quit 2>/dev/null | /bin/grep -q .; then echo "$0: /docker-entrypoint.d/ is not empty, launching Unit daemon to perform initial configuration..." - /usr/sbin/unitd --control unix:/var/run/control.unit.sock + /usr/sbin/$1 --control unix:/var/run/control.unit.sock while [ ! -S /var/run/control.unit.sock ]; do echo "$0: Waiting for control socket to be created..."; /bin/sleep 0.1; done # even when the control socket exists, it does not mean unit has finished initialisation From 5e40c969c7c5553d9a2814fe472c71beb77e5e09 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Wed, 1 Dec 2021 11:25:34 +0000 Subject: [PATCH 10/19] Tests: fixed skipping tests with disabled OPcache. --- test/php/cwd/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/php/cwd/index.php b/test/php/cwd/index.php index de3797e4..eb2cc5b3 100644 --- a/test/php/cwd/index.php +++ b/test/php/cwd/index.php @@ -11,7 +11,7 @@ $opcache = -1; if (function_exists('opcache_get_status')) { $status = opcache_get_status(); - $opcache = $status['opcache_enabled']; + $opcache = $status['opcache_enabled'] ? '1' : '0'; } header('X-OPcache: ' . $opcache); From b8ea9d34fdff699006ecfdbd948f113686d2dc0c Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Wed, 1 Dec 2021 17:09:02 +0300 Subject: [PATCH 11/19] Logging of the daemon version on startup. --- src/nxt_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nxt_main.c b/src/nxt_main.c index 03403991..26bee873 100644 --- a/src/nxt_main.c +++ b/src/nxt_main.c @@ -30,7 +30,7 @@ main(int argc, char **argv) return 1; } - nxt_log(&nxt_main_task, NXT_LOG_INFO, "unit started"); + nxt_log(&nxt_main_task, NXT_LOG_INFO, "unit " NXT_VERSION " started"); nxt_event_engine_start(nxt_main_task.thread->engine); From 97e61aad736da5fe1ad136a1d3055e16698f7d2b Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Wed, 1 Dec 2021 18:05:50 +0300 Subject: [PATCH 12/19] Fixing prototype process crash. A prototype stores linked application processes structures. When an application process terminates, it's removed from the list. To avoid double removal, the pointer to the next element should be set to NULL. The issue was introduced in c8790d2a89bb. --- docs/changes.xml | 7 +++++++ src/nxt_application.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/docs/changes.xml b/docs/changes.xml index ba86da5e..2bbec889 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -52,6 +52,13 @@ fastcgi_finish_request() was called in the OPcache preloading script. + + +a prototype process could crash on an application process exit; the bug had +appeared in 1.26.0. + + + diff --git a/src/nxt_application.c b/src/nxt_application.c index 589821fb..82385ec4 100644 --- a/src/nxt_application.c +++ b/src/nxt_application.c @@ -1147,6 +1147,8 @@ nxt_proto_process_remove(nxt_task_t *task, nxt_pid_t pid) process = lhq.value; nxt_queue_remove(&process->link); + process->link.next = NULL; + break; default: From 2d6e926a1def94e4def5b8f8da73078685626ff4 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Wed, 1 Dec 2021 18:06:38 +0300 Subject: [PATCH 13/19] Disabling SCM_CREDS usage on DragonFly BSD. DragonFly BSD supports SCM_CREDS and SCM_RIGHTS, but only the first control message is passed correctly while the second one isn't processed by the kernel. This closes #599 issue on GitHub. --- auto/sockets | 68 +++++++++++++++++++++++++----------------------- docs/changes.xml | 6 +++++ 2 files changed, 41 insertions(+), 33 deletions(-) diff --git a/auto/sockets b/auto/sockets index 1b6b4368..e6ef326d 100644 --- a/auto/sockets +++ b/auto/sockets @@ -166,51 +166,53 @@ if [ $nxt_found = no ]; then fi -nxt_feature="sockopt SO_PASSCRED" -nxt_feature_name=NXT_HAVE_SOCKOPT_SO_PASSCRED -nxt_feature_run= -nxt_feature_incs= -nxt_feature_libs= -nxt_feature_test="#define _GNU_SOURCE - #include - - int main() { - return SO_PASSCRED == 0; - }" -. auto/feature - - -if [ $nxt_found = yes ]; then - nxt_feature="struct ucred" - nxt_feature_name=NXT_HAVE_UCRED +if [ $NXT_SYSTEM != DragonFly ]; then + nxt_feature="sockopt SO_PASSCRED" + nxt_feature_name=NXT_HAVE_SOCKOPT_SO_PASSCRED nxt_feature_run= nxt_feature_incs= nxt_feature_libs= nxt_feature_test="#define _GNU_SOURCE #include - #include int main() { - return sizeof(struct ucred); + return SO_PASSCRED == 0; + }" + . auto/feature + + + if [ $nxt_found = yes ]; then + nxt_feature="struct ucred" + nxt_feature_name=NXT_HAVE_UCRED + nxt_feature_run= + nxt_feature_incs= + nxt_feature_libs= + nxt_feature_test="#define _GNU_SOURCE + #include + #include + + int main() { + return sizeof(struct ucred); + }" + . auto/feature + fi + + + nxt_feature="struct cmsgcred" + nxt_feature_name=NXT_HAVE_MSGHDR_CMSGCRED + nxt_feature_run= + nxt_feature_incs= + nxt_feature_libs= + nxt_feature_test="#define _GNU_SOURCE + #include + + int main() { + return sizeof(struct cmsgcred); }" . auto/feature fi -nxt_feature="struct cmsgcred" -nxt_feature_name=NXT_HAVE_MSGHDR_CMSGCRED -nxt_feature_run= -nxt_feature_incs= -nxt_feature_libs= -nxt_feature_test="#define _GNU_SOURCE - #include - - int main() { - return sizeof(struct cmsgcred); - }" -. auto/feature - - nxt_feature="sys/filio.h" nxt_feature_name=NXT_HAVE_SYS_FILIO_H nxt_feature_run= diff --git a/docs/changes.xml b/docs/changes.xml index 2bbec889..7460aa65 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -59,6 +59,12 @@ appeared in 1.26.0. + + +fatal errors on DragonFly BSD; the bug had appeared in 1.26.0. + + + From 8aa40e5901d1f9d05c35ddb7b93c2df8328d3e60 Mon Sep 17 00:00:00 2001 From: Andrei Belov Date: Thu, 2 Dec 2021 08:52:52 +0300 Subject: [PATCH 14/19] Packages: added systemd service for debug binary. --- pkg/deb/debian/rules.in | 3 ++- pkg/deb/debian/unit-debug.service | 14 +++++++++++ pkg/rpm/rpmbuild/SOURCES/unit-debug.service | 26 +++++++++++++++++++++ pkg/rpm/unit.spec.in | 12 ++++++---- 4 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 pkg/deb/debian/unit-debug.service create mode 100644 pkg/rpm/rpmbuild/SOURCES/unit-debug.service diff --git a/pkg/deb/debian/rules.in b/pkg/deb/debian/rules.in index 3f1f9db8..fe7d5c7c 100644 --- a/pkg/deb/debian/rules.in +++ b/pkg/deb/debian/rules.in @@ -99,7 +99,8 @@ install: build do.tests dh_testroot dh_prep dh_installdirs - dh_installsystemd + dh_installsystemd -punit --name=unit unit.service + dh_installsystemd -punit --name=unit-debug --no-start --no-enable unit-debug.service dh_installlogrotate cd $(BUILDDIR_unit) && DESTDIR=$(INSTALLDIR) make install cd $(BUILDDIR_unit) && DESTDIR=$(INSTALLDIR_dev) make libunit-install diff --git a/pkg/deb/debian/unit-debug.service b/pkg/deb/debian/unit-debug.service new file mode 100644 index 00000000..252d8451 --- /dev/null +++ b/pkg/deb/debian/unit-debug.service @@ -0,0 +1,14 @@ +[Unit] +Description=NGINX Unit +Wants=network-online.target +After=network-online.target + +[Service] +Type=forking +PIDFile=/var/run/unit.pid +EnvironmentFile=-/etc/default/unit +ExecStart=/usr/sbin/unitd-debug $DAEMON_ARGS +ExecReload= + +[Install] +WantedBy=multi-user.target diff --git a/pkg/rpm/rpmbuild/SOURCES/unit-debug.service b/pkg/rpm/rpmbuild/SOURCES/unit-debug.service new file mode 100644 index 00000000..2cef24fb --- /dev/null +++ b/pkg/rpm/rpmbuild/SOURCES/unit-debug.service @@ -0,0 +1,26 @@ +# Modifying this file in-place is not recommended, because changes +# will be overwritten during package upgrades. To customize the +# behaviour, run "systemctl edit unit-debug" to create an override unit. + +# For example, to change options given to the unitd binary at startup, +# create an override unit (as is done by systemctl edit) and enter +# the following: + +# [Service] +# Environment="UNITD_OPTIONS=--log /var/log/unit/unit.log --pid /var/run/unit/unit.pid" + +[Unit] +Description=NGINX Unit +Wants=network-online.target +After=network-online.target + +[Service] +Type=simple +Environment="UNITD_OPTIONS=--log /var/log/unit/unit.log --pid /var/run/unit/unit.pid" +ExecStart=/usr/sbin/unitd-debug $UNITD_OPTIONS --no-daemon +ExecReload= +RuntimeDirectory=unit +RuntimeDirectoryMode=0755 + +[Install] +WantedBy=multi-user.target diff --git a/pkg/rpm/unit.spec.in b/pkg/rpm/unit.spec.in index b35b8998..f643b77f 100644 --- a/pkg/rpm/unit.spec.in +++ b/pkg/rpm/unit.spec.in @@ -39,8 +39,9 @@ Group: System Environment/Daemons Source0: unit-%{version}.tar.gz Source1: unit.service -Source2: unit.example.config -Source3: unit.logrotate +Source2: unit-debug.service +Source3: unit.example.config +Source4: unit.logrotate BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: systemd @@ -112,11 +113,11 @@ DESTDIR=%{buildroot} make unitd-install libunit-install manpage-install %{__mkdir} -p %{buildroot}%{_localstatedir}/log/unit %{__mkdir} -p %{buildroot}%{_localstatedir}/run/unit %{__mkdir} -p %{buildroot}%{_sysconfdir}/logrotate.d -%{__install} -m 644 -p %{SOURCE3} \ +%{__install} -m 644 -p %{SOURCE4} \ %{buildroot}%{_sysconfdir}/logrotate.d/unit %{__mkdir} -p %{buildroot}%{_sysconfdir}/unit %{__mkdir} -p %{buildroot}%{_datadir}/doc/unit/examples -%{__install} -m 644 -p %{SOURCE2} \ +%{__install} -m 644 -p %{SOURCE3} \ %{buildroot}%{_datadir}/doc/unit/examples/example.config %{__install} -m 644 -p CHANGES \ %{buildroot}%{_datadir}/doc/unit/ @@ -127,6 +128,7 @@ DESTDIR=%{buildroot} make unitd-install libunit-install manpage-install %{__rm} -rf %{buildroot}%{_initrddir}/ %{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/unit.service +%{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/unit-debug.service QA_SKIP_BUILD_ROOT=1 export QA_SKIP_BUILD_ROOT @@ -153,6 +155,7 @@ getent passwd unit >/dev/null || \ -d /nonexistent -c "unit user" unit if [ $1 -eq 1 ]; then /usr/bin/systemctl preset unit.service >/dev/null 2>&1 ||: + /usr/bin/systemctl preset unit-debug.service >/dev/null 2>&1 ||: cat < Date: Thu, 2 Dec 2021 14:12:13 +0000 Subject: [PATCH 15/19] Fixed grammar in "changes.xml". --- docs/changes.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changes.xml b/docs/changes.xml index 7460aa65..5dd8d98b 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -33,7 +33,7 @@ NGINX Unit updated to 1.26.1. -the router process crash on reconfiguration if "access_log" was configured +the router process crashed on reconfiguration if "access_log" was configured without listeners. From 5212d60ccf06d128f758b56dc5f5dd0538f20d5d Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Thu, 2 Dec 2021 18:22:48 +0300 Subject: [PATCH 16/19] Reordered changes for 1.26.1 by significance (subjective). --- docs/changes.xml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/changes.xml b/docs/changes.xml index 5dd8d98b..9ede7833 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -31,13 +31,6 @@ NGINX Unit updated to 1.26.1. date="" time="" packager="Andrei Belov <defan@nginx.com>"> - - -the router process crashed on reconfiguration if "access_log" was configured -without listeners. - - - occasionally, the Unit daemon was unable to fully terminate; the bug had @@ -47,15 +40,22 @@ appeared in 1.26.0. -a segmentation fault occurred in the PHP module if chdir() or -fastcgi_finish_request() was called in the OPcache preloading script. +a prototype process could crash on an application process exit; the bug had +appeared in 1.26.0. -a prototype process could crash on an application process exit; the bug had -appeared in 1.26.0. +the router process crashed on reconfiguration if "access_log" was configured +without listeners. + + + + + +a segmentation fault occurred in the PHP module if chdir() or +fastcgi_finish_request() was called in the OPcache preloading script. From 02f24f695c73f89f12097c6541732403fa854eae Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Thu, 2 Dec 2021 18:22:57 +0300 Subject: [PATCH 17/19] Added version 1.26.1 CHANGES. --- CHANGES | 18 ++++++++++++++++++ docs/changes.xml | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 0c93d2bc..d7fa5641 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,22 @@ +Changes with Unit 1.26.1 02 Dec 2021 + + *) Bugfix: occasionally, the Unit daemon was unable to fully terminate; + the bug had appeared in 1.26.0. + + *) Bugfix: a prototype process could crash on an application process + exit; the bug had appeared in 1.26.0. + + *) Bugfix: the router process crashed on reconfiguration if "access_log" + was configured without listeners. + + *) Bugfix: a segmentation fault occurred in the PHP module if chdir() or + fastcgi_finish_request() was called in the OPcache preloading script. + + *) Bugfix: fatal errors on DragonFly BSD; the bug had appeared in + 1.26.0. + + Changes with Unit 1.26.0 18 Nov 2021 *) Change: the "share" option now specifies the entire path to the files diff --git a/docs/changes.xml b/docs/changes.xml index 9ede7833..849f50f5 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -15,7 +15,7 @@ unit-jsc-common unit-jsc8 unit-jsc10 unit-jsc11 unit-jsc13 unit-jsc14 unit-jsc15 unit-jsc16 unit-jsc17 unit-jsc18" ver="1.26.1" rev="1" - date="" time="" + date="2021-12-02" time="18:00:00 +0300" packager="Andrei Belov <defan@nginx.com>"> @@ -28,7 +28,7 @@ NGINX Unit updated to 1.26.1. From 8b954d833110c70f641561fd141b27b2b72a5022 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Thu, 2 Dec 2021 18:23:00 +0300 Subject: [PATCH 18/19] Generated Dockerfiles for Unit 1.26.1. --- pkg/docker/Dockerfile.go1.17 | 2 +- pkg/docker/Dockerfile.jsc11 | 2 +- pkg/docker/Dockerfile.minimal | 2 +- pkg/docker/Dockerfile.node16 | 2 +- pkg/docker/Dockerfile.perl5.34 | 2 +- pkg/docker/Dockerfile.php8.0 | 2 +- pkg/docker/Dockerfile.python3.9 | 2 +- pkg/docker/Dockerfile.ruby3.0 | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/docker/Dockerfile.go1.17 b/pkg/docker/Dockerfile.go1.17 index 2555cb23..e7443e8c 100644 --- a/pkg/docker/Dockerfile.go1.17 +++ b/pkg/docker/Dockerfile.go1.17 @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.26.0 \ + && hg up 1.26.1 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ diff --git a/pkg/docker/Dockerfile.jsc11 b/pkg/docker/Dockerfile.jsc11 index 091ddf01..8e89fc22 100644 --- a/pkg/docker/Dockerfile.jsc11 +++ b/pkg/docker/Dockerfile.jsc11 @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.26.0 \ + && hg up 1.26.1 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ diff --git a/pkg/docker/Dockerfile.minimal b/pkg/docker/Dockerfile.minimal index 18c02898..36c9af1c 100644 --- a/pkg/docker/Dockerfile.minimal +++ b/pkg/docker/Dockerfile.minimal @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.26.0 \ + && hg up 1.26.1 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ diff --git a/pkg/docker/Dockerfile.node16 b/pkg/docker/Dockerfile.node16 index 386d0c24..3b4a98e2 100644 --- a/pkg/docker/Dockerfile.node16 +++ b/pkg/docker/Dockerfile.node16 @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.26.0 \ + && hg up 1.26.1 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ diff --git a/pkg/docker/Dockerfile.perl5.34 b/pkg/docker/Dockerfile.perl5.34 index 624a059c..cee1a829 100644 --- a/pkg/docker/Dockerfile.perl5.34 +++ b/pkg/docker/Dockerfile.perl5.34 @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.26.0 \ + && hg up 1.26.1 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ diff --git a/pkg/docker/Dockerfile.php8.0 b/pkg/docker/Dockerfile.php8.0 index f3a1e10b..07290b74 100644 --- a/pkg/docker/Dockerfile.php8.0 +++ b/pkg/docker/Dockerfile.php8.0 @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.26.0 \ + && hg up 1.26.1 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ diff --git a/pkg/docker/Dockerfile.python3.9 b/pkg/docker/Dockerfile.python3.9 index 87e807cc..22491edb 100644 --- a/pkg/docker/Dockerfile.python3.9 +++ b/pkg/docker/Dockerfile.python3.9 @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.26.0 \ + && hg up 1.26.1 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ diff --git a/pkg/docker/Dockerfile.ruby3.0 b/pkg/docker/Dockerfile.ruby3.0 index da4dd559..8da13e20 100644 --- a/pkg/docker/Dockerfile.ruby3.0 +++ b/pkg/docker/Dockerfile.ruby3.0 @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.26.0 \ + && hg up 1.26.1 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ From 85908c09f9b7d8d0bd797427d984e2697ece8267 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Thu, 2 Dec 2021 18:36:28 +0300 Subject: [PATCH 19/19] Unit 1.26.1 release. --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 842feb86..7a1588e8 100644 --- a/.hgtags +++ b/.hgtags @@ -33,3 +33,4 @@ f804aaf7eee10a7d8116820840d6312dd4914a41 1.21.0 847c88d10f26765b45149c14f88c2274adfc3f42 1.24.0 54ffe5ce4fb3c4304faf6d342d9b17dee2c745ac 1.25.0 2be7b623fbfafdb470d832a28abb1cd55c76e04f 1.26.0 +1a08f884b24effa8b843d6aeeaf016b6354d1256 1.26.1