Skip to content

Commit 99ea68a

Browse files
authored
bugfix: we closed listener's fd which was closed. (openresty#1832)
fix openresty#1806 fix openresty#1830
1 parent d59afff commit 99ea68a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/ngx_http_lua_pipe.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,10 @@ ngx_http_lua_ffi_pipe_spawn(ngx_http_lua_ffi_pipe_proc_t *proc,
688688
/* close listening socket fd */
689689
ls = ngx_cycle->listening.elts;
690690
for (i = 0; i < ngx_cycle->listening.nelts; i++) {
691-
if (ngx_close_socket(ls[i].fd) == -1) {
692-
ngx_log_error(NGX_LOG_EMERG, ngx_cycle->log, ngx_socket_errno,
691+
if (ls[i].fd != (ngx_socket_t) -1 &&
692+
ngx_close_socket(ls[i].fd) == -1)
693+
{
694+
ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, ngx_socket_errno,
693695
"lua pipe child " ngx_close_socket_n
694696
" %V failed", &ls[i].addr_text);
695697
}

0 commit comments

Comments
 (0)