diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-11-21 17:50:39 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-11-21 17:50:39 +0000 |
commit | afcda997e027f9ce5c557c933445c66c9441be6b (patch) | |
tree | dcb9e0976cbdb4c63728dc060be841426a516db0 /src/libserver | |
parent | b8311035d0b4cde1047568260e997e861f0f318c (diff) | |
download | rspamd-afcda997e027f9ce5c557c933445c66c9441be6b.tar.gz rspamd-afcda997e027f9ce5c557c933445c66c9441be6b.zip |
[Fix] Add workaround for ENOBUFS error on sending
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/rspamd_control.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/libserver/rspamd_control.c b/src/libserver/rspamd_control.c index e1c39ccaa..82913a19f 100644 --- a/src/libserver/rspamd_control.c +++ b/src/libserver/rspamd_control.c @@ -925,6 +925,8 @@ rspamd_srv_handler (EV_P_ ev_io *w, int revents) * Usually this means that a worker is dead, so do not try to read * anything */ + msg_err ("cannot read from worker's srv pipe connection closed; command = %s", + rspamd_srv_command_to_string(cmd.type)); ev_io_stop (EV_A_ w); } else if (r != sizeof (cmd)) { @@ -1144,6 +1146,16 @@ rspamd_srv_request_handler (EV_P_ ev_io *w, int revents) r = sendmsg (w->fd, &msg, 0); if (r == -1) { + if (r == ENOBUFS) { + /* On BSD derived systems we can have this error when trying to send + * requests too fast. + * It might be good to retry... + */ + msg_info ("cannot write to server pipe: %s; command = %s; retrying sending", + strerror (errno), + rspamd_srv_command_to_string(rd->cmd.type)); + return; + } msg_err ("cannot write to server pipe: %s; command = %s", strerror (errno), rspamd_srv_command_to_string(rd->cmd.type)); goto cleanup; @@ -1185,17 +1197,18 @@ rspamd_srv_request_handler (EV_P_ ev_io *w, int revents) rfd = *(int *) CMSG_DATA(CMSG_FIRSTHDR (&msg)); } + /* Reply has been received */ + if (rd->handler) { + rd->handler (rd->worker, &rd->rep, rfd, rd->ud); + } + goto cleanup; } return; -cleanup: - - if (rd->handler) { - rd->handler (rd->worker, &rd->rep, rfd, rd->ud); - } +cleanup: ev_io_stop (EV_A_ w); g_free (rd); } |