Skip to content
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

http server may hang in receive() when remote connection is closed abruptly #157

Closed
rdumusc opened this issue May 13, 2016 · 3 comments
Closed
Labels

Comments

@rdumusc
Copy link

rdumusc commented May 13, 2016

The application deadlocks at ::zmq::send() at lines 195-197 of server.cpp trying to send a return code 200:

if( ::zmq_send( socket, id, idSize, ZMQ_SNDMORE ) != idSize ||
        ::zmq_send( socket, rep.c_str(), rep.length(), more ) !=
        int( rep.length( )))
{
ZEROEQWARN << "Could not send HTTP response header: "
                          << zmq_strerror( zmq_errno( )) << std::endl;
return;
}
@rdumusc rdumusc added the bug label May 13, 2016
@tribal-tec
Copy link
Contributor

Setting ZMQ_LINGER to something low or even 0 is one fix. ZMQ_NOBLOCK could as well, but appears to have issue on closing the socket:
http://stackoverflow.com/questions/7538988/zeromq-how-to-prevent-infinite-wait

@tribal-tec
Copy link
Contributor

Thanks to @favreau for testing. ZMQ_NOBLOCK seems to do the trick. Will attack this next week and try to add test for it :)

@favreau
Copy link
Contributor

favreau commented May 27, 2016

Thanks @tribal-tec ! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants