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

REQ not sending ETIMEDOUT #93

Closed
thelinuxlich opened this issue Jun 1, 2015 · 16 comments
Closed

REQ not sending ETIMEDOUT #93

thelinuxlich opened this issue Jun 1, 2015 · 16 comments

Comments

@thelinuxlich
Copy link

According to @gdamore on nanomsg gitter channel:

REQ will return ETIMEDOUT on recv() if the timeout expires.

So far I've tried every configuration possible and req.on("timeout", function() { ... }) never fires.

@gdamore
Copy link

gdamore commented Jun 1, 2015

Make sure the NN_RCVTIMEO option is set though!

On Jun 1, 2015, at 2:17 PM, Alisson Cavalcante Agiani notifications@github.com wrote:

According to @gdamore https://github.com/gdamore on nanomsg gitter channel:

REQ will return ETIMEDOUT on recv() if the timeout expires.
So far I've tried every configuration possible and req.on("timeout", function() { ... }) never fires.


Reply to this email directly or view it on GitHub #93.

@thelinuxlich
Copy link
Author

Oh yeah, I've tried setting it to 1, nothing happened

@nickdesaulniers
Copy link
Owner

@thelinuxlich do you have a small test case we could add to our test suite to work against?

@gdamore
Copy link

gdamore commented Jun 1, 2015

Btw, ETIMEOUT does not apply to RAW sockets -- only to cooked ones.

@gdamore
Copy link

gdamore commented Jun 1, 2015

Huh. In my testing I'm getting EAGAIN instead of ETIMEDOUT. That's ... not what it should be.

@nickdesaulniers
Copy link
Owner

@gdamore , note we statically link an older version of Nanomsg. If that was recently fixed, we can update our dependency.

@gdamore
Copy link

gdamore commented Jun 1, 2015

Huh. In libnanomsg ETIMEDOUT is intentionally turned into EAGAIN:
rc = nn_efd_wait (&self->rcvfd, timeout);
if (nn_slow (rc == -ETIMEDOUT))
return -EAGAIN;

This feels like a mistake to me, but I need to make further research. Nonetheless, EAGAIN or ETIMEDOUT -- you do get a timeout. Blocking mode only of course. (nonblocking sockets cannot distinguish a "timeout" as such.)

@thelinuxlich
Copy link
Author

hmmm req.send is non-blocking in node-nanomsg? If it is we are lost concerning timeouts? :(

@thelinuxlich
Copy link
Author

@nickdesaulniers I'm trying to get the timeout event with this simple server implementation: https://gist.github.com/thelinuxlich/1e55ef121874d127ceca

@nickdesaulniers
Copy link
Owner

Well, you're missing a rep socket. Req/rep are meant to be used as a pair. I should add an example for this...

@nickdesaulniers
Copy link
Owner

for now, see this test

@thelinuxlich
Copy link
Author

no, I'm testing exactly the absence of a consumer listening to see a timeout event

@nickdesaulniers
Copy link
Owner

indeed, we do not emit a timeout event anywhere. Note the ability to specify socket options were added recently, and aren't fully tested other than check for their existence. See #52. What function in nanomsg returns ETIMEOUT or EAGAIN? That would help me figure out how to wire it up.

@nickdesaulniers
Copy link
Owner

Stack looks like nn_send -> nn_sendmsg -> nn_sock_send -> EAGAIN

@thelinuxlich
Copy link
Author

@gdamore said REQ is sending EAGAIN

@gdamore
Copy link

gdamore commented Jun 2, 2015

nn_recv gets the EAGAIN.

Sent from my iPhone

On Jun 1, 2015, at 3:17 PM, Nick Desaulniers notifications@github.com wrote:

Stack looks like nn_send -> nn_sendmsg -> nn_sock_send -> EAGAIN


Reply to this email directly or view it on GitHub.

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

No branches or pull requests

3 participants