Skip to content

bugfix: we closed listener's fd which was closed. #1832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/ngx_http_lua_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,8 +688,10 @@ ngx_http_lua_ffi_pipe_spawn(ngx_http_lua_ffi_pipe_proc_t *proc,
/* close listening socket fd */
ls = ngx_cycle->listening.elts;
for (i = 0; i < ngx_cycle->listening.nelts; i++) {
if (ngx_close_socket(ls[i].fd) == -1) {
ngx_log_error(NGX_LOG_EMERG, ngx_cycle->log, ngx_socket_errno,
if (ls[i].fd != (ngx_socket_t) -1 &&
ngx_close_socket(ls[i].fd) == -1)
{
ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, ngx_socket_errno,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm glad that we seem to agree on the severity level; if we are to downgrade this log to warn (which I believe is appropriate), don't we ought it too to lower the below logs as well? That is, all calls to ngx_log_error that aren't followed by exit() I mean.

That said, not a blocker for this fix of course, since the above check in the condition is all this PR should need 👍

"lua pipe child " ngx_close_socket_n
" %V failed", &ls[i].addr_text);
}
Expand Down