diff --git a/patches/nginx-1.19.3-privileged_agent_process_connections.patch b/patches/nginx-1.19.3-privileged_agent_process_connections.patch index c05790c..bf20967 100644 --- a/patches/nginx-1.19.3-privileged_agent_process_connections.patch +++ b/patches/nginx-1.19.3-privileged_agent_process_connections.patch @@ -51,3 +51,23 @@ index b1eb322..8e03696 100644 ngx_worker_process_init(cycle, -1); +diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c +index df25f9d..bd259c1 100644 +--- a/src/os/unix/ngx_process_cycle.c ++++ b/src/os/unix/ngx_process_cycle.c +@@ -442,6 +442,15 @@ + return; + } + ++ /* 0 is an illegal value and may result in a core dump later */ ++ if (ccf->privileged_agent_connections == 0) { ++ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, ++ "%ui worker_connections are not enough, " ++ "privileged agent process cannot be spawned", ++ ccf->privileged_agent_connections); ++ return; ++ } ++ + ngx_spawn_process(cycle, ngx_privileged_agent_process_cycle, + "privileged agent process", "privileged agent process", + respawn ? NGX_PROCESS_JUST_RESPAWN : NGX_PROCESS_RESPAWN); diff --git a/patches/nginx-1.19.9-privileged_agent_process_connections.patch b/patches/nginx-1.19.9-privileged_agent_process_connections.patch index c642cfa..7649cc5 100644 --- a/patches/nginx-1.19.9-privileged_agent_process_connections.patch +++ b/patches/nginx-1.19.9-privileged_agent_process_connections.patch @@ -51,3 +51,23 @@ index df25f9d..bd259c1 100644 ngx_worker_process_init(cycle, -1); +diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c +index df25f9d..bd259c1 100644 +--- a/src/os/unix/ngx_process_cycle.c ++++ b/src/os/unix/ngx_process_cycle.c +@@ -442,6 +442,15 @@ + return; + } + ++ /* 0 is an illegal value and may result in a core dump later */ ++ if (ccf->privileged_agent_connections == 0) { ++ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, ++ "%ui worker_connections are not enough, " ++ "privileged agent process cannot be spawned", ++ ccf->privileged_agent_connections); ++ return; ++ } ++ + ngx_spawn_process(cycle, ngx_privileged_agent_process_cycle, + "privileged agent process", "privileged agent process", + respawn ? NGX_PROCESS_JUST_RESPAWN : NGX_PROCESS_RESPAWN); diff --git a/patches/nginx-1.21.3-privileged_agent_process_connections.patch b/patches/nginx-1.21.3-privileged_agent_process_connections.patch index c642cfa..7649cc5 100644 --- a/patches/nginx-1.21.3-privileged_agent_process_connections.patch +++ b/patches/nginx-1.21.3-privileged_agent_process_connections.patch @@ -51,3 +51,23 @@ index df25f9d..bd259c1 100644 ngx_worker_process_init(cycle, -1); +diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c +index df25f9d..bd259c1 100644 +--- a/src/os/unix/ngx_process_cycle.c ++++ b/src/os/unix/ngx_process_cycle.c +@@ -442,6 +442,15 @@ + return; + } + ++ /* 0 is an illegal value and may result in a core dump later */ ++ if (ccf->privileged_agent_connections == 0) { ++ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, ++ "%ui worker_connections are not enough, " ++ "privileged agent process cannot be spawned", ++ ccf->privileged_agent_connections); ++ return; ++ } ++ + ngx_spawn_process(cycle, ngx_privileged_agent_process_cycle, + "privileged agent process", "privileged agent process", + respawn ? NGX_PROCESS_JUST_RESPAWN : NGX_PROCESS_RESPAWN); diff --git a/patches/nginx-1.21.4-privileged_agent_process_connections.patch b/patches/nginx-1.21.4-privileged_agent_process_connections.patch index c642cfa..7649cc5 100644 --- a/patches/nginx-1.21.4-privileged_agent_process_connections.patch +++ b/patches/nginx-1.21.4-privileged_agent_process_connections.patch @@ -51,3 +51,23 @@ index df25f9d..bd259c1 100644 ngx_worker_process_init(cycle, -1); +diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c +index df25f9d..bd259c1 100644 +--- a/src/os/unix/ngx_process_cycle.c ++++ b/src/os/unix/ngx_process_cycle.c +@@ -442,6 +442,15 @@ + return; + } + ++ /* 0 is an illegal value and may result in a core dump later */ ++ if (ccf->privileged_agent_connections == 0) { ++ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, ++ "%ui worker_connections are not enough, " ++ "privileged agent process cannot be spawned", ++ ccf->privileged_agent_connections); ++ return; ++ } ++ + ngx_spawn_process(cycle, ngx_privileged_agent_process_cycle, + "privileged agent process", "privileged agent process", + respawn ? NGX_PROCESS_JUST_RESPAWN : NGX_PROCESS_RESPAWN);