diff options
author | Andrei Belov <defan@nginx.com> | 2021-12-02 18:42:23 +0300 |
---|---|---|
committer | Andrei Belov <defan@nginx.com> | 2021-12-02 18:42:23 +0300 |
commit | 7634ab0f21c712e79c5d09e5817f866ff71d4f49 (patch) | |
tree | 1c4b20be29a9372858088c9faa3f02e7f584402f | |
parent | 5dfde9717d9ef611072defdd211089efa920c728 (diff) | |
parent | 85908c09f9b7d8d0bd797427d984e2697ece8267 (diff) | |
download | unit-1.26.1-1.tar.gz unit-1.26.1-1.tar.bz2 |
Merged with the 1.26 branch.1.26.1-1
31 files changed, 238 insertions, 71 deletions
@@ -59,3 +59,4 @@ ad6aad2450c256d4f1a3c32f7091a78dbbc4a6d1 1.23.0-1 aa207ced9712132040e6153ceccdaf04c112d02c 1.25.0-1 2be7b623fbfafdb470d832a28abb1cd55c76e04f 1.26.0 1613ff17671df2273d48be57115f5fe4827f8cd5 1.26.0-1 +1a08f884b24effa8b843d6aeeaf016b6354d1256 1.26.1 @@ -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/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 <sys/socket.h> +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 <sys/socket.h> - int main() { - return SO_PASSCRED == 0; - }" -. auto/feature + 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_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 <sys/socket.h> + #include <sys/un.h> + + 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 <sys/socket.h> - #include <sys/un.h> int main() { - return sizeof(struct ucred); + 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 <sys/socket.h> - - 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 af395fd3..de96451b 100644 --- a/docs/changes.xml +++ b/docs/changes.xml @@ -5,6 +5,69 @@ <change_log title="unit"> +<changes apply="unit-php + unit-python unit-python2.7 + unit-python3.4 unit-python3.5 unit-python3.6 unit-python3.7 + unit-python3.8 unit-python3.9 unit-python3.10 + unit-go + unit-perl + unit-ruby + 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="2021-12-02" time="18:00:00 +0300" + packager="Andrei Belov <defan@nginx.com>"> + +<change> +<para> +NGINX Unit updated to 1.26.1. +</para> +</change> + +</changes> + + +<changes apply="unit" ver="1.26.1" rev="1" + date="2021-12-02" time="18:00:00 +0300" + packager="Andrei Belov <defan@nginx.com>"> + +<change type="bugfix"> +<para> +occasionally, the Unit daemon was unable to fully terminate; the bug had +appeared in 1.26.0. +</para> +</change> + +<change type="bugfix"> +<para> +a prototype process could crash on an application process exit; the bug had +appeared in 1.26.0. +</para> +</change> + +<change type="bugfix"> +<para> +the router process crashed on reconfiguration if "access_log" was configured +without listeners. +</para> +</change> + +<change type="bugfix"> +<para> +a segmentation fault occurred in the PHP module if chdir() or +fastcgi_finish_request() was called in the OPcache preloading script. +</para> +</change> + +<change type="bugfix"> +<para> +fatal errors on DragonFly BSD; the bug had appeared in 1.26.0. +</para> +</change> + +</changes> + + <changes apply="unit-jsc18" ver="1.26.0" rev="1" date="2021-11-18" time="18:00:00 +0300" packager="Andrei Belov <defan@nginx.com>"> 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 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/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)" \ 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 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 <<BANNER ---------------------------------------------------------------------- @@ -200,6 +203,7 @@ BANNER %attr(0755,root,root) %{_sbindir}/unitd-debug %dir %{_sysconfdir}/unit %{_unitdir}/unit.service +%{_unitdir}/unit-debug.service %dir %attr(0755,root,root) %ghost %{_localstatedir}/run/unit %dir %{_datadir}/doc/unit %{_datadir}/doc/unit/* 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: 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); 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); 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; } 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); 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) @@ -3923,6 +3929,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) { 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]); 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); @@ -1,5 +1,5 @@ # Copyright (C) NGINX, Inc. -NXT_VERSION=1.26.0 -NXT_VERNUM=12600 +NXT_VERSION=1.26.1 +NXT_VERNUM=12601 |