mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-12 10:33:52 +01:00
Problem: message can't be received due to signal
Issue caught in Golang runtime, which widely uses signal SIGURG for scheduling. Sometimes messages cannot be received. Technically socket_base_t::process_commands() returns failure even if some commands were processed, but next message from mailbox could not be received during interrupt. Solution: retry receiving from mailbox with zero timeout after EINTR. Signed-off-by: Ilya Kondrashkin <ikondrashkin@nfware.com>
This commit is contained in:
parent
8d0f6f359e
commit
04720b6b91
13
RELICENSE/nfware.md
Normal file
13
RELICENSE/nfware.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Permission to Relicense under MPLv2 or any other OSI approved license chosen by the current ZeroMQ BDFL
|
||||
|
||||
This is a statement by NFWare Corp. that grants permission to relicense its copyrights in the libzmq C++
|
||||
library (ZeroMQ) under the Mozilla Public License v2 (MPLv2) or any other
|
||||
Open Source Initiative approved license chosen by the current ZeroMQ
|
||||
BDFL (Benevolent Dictator for Life).
|
||||
|
||||
A portion of the commits made by the Github handle "ilkondr", with
|
||||
commit author "Ilya Kondrashkin <ikondrashkin@nfware.com>", are copyright of NFWare.
|
||||
This document hereby grants the libzmq project team to relicense libzmq,
|
||||
including all past, present and future contributions of the author listed above.
|
||||
|
||||
Ilya Kondrashkin 2023/01/10
|
@ -1504,15 +1504,17 @@ int zmq::socket_base_t::process_commands (int timeout_, bool throttle_)
|
||||
command_t cmd;
|
||||
int rc = _mailbox->recv (&cmd, timeout_);
|
||||
|
||||
if (rc != 0 && errno == EINTR)
|
||||
return -1;
|
||||
|
||||
// Process all available commands.
|
||||
while (rc == 0) {
|
||||
cmd.destination->process_command (cmd);
|
||||
while (rc == 0 || errno == EINTR) {
|
||||
if (rc == 0) {
|
||||
cmd.destination->process_command (cmd);
|
||||
}
|
||||
rc = _mailbox->recv (&cmd, 0);
|
||||
}
|
||||
|
||||
if (errno == EINTR)
|
||||
return -1;
|
||||
|
||||
zmq_assert (errno == EAGAIN);
|
||||
|
||||
if (_ctx_terminated) {
|
||||
|
Loading…
Reference in New Issue
Block a user