Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@rdumusc
Copy link

@rdumusc rdumusc commented Sep 7, 2016

These unexpected messages caused Tide's RestServer to block the main
thread after each http request in zmq_recv() at line 144 of
zeroeq/http/server.cpp.

The exact combination of operations in this patch is necessary to ensure
that none of the following unit tests block indefinitely:

  • zeroeq/http/server - issue157
  • tide/cpp/core/RestServerTests - testServerReturnsSimpleContent

and that normal receive operations (as tested with Tide's REST interface)
still work as expected (no messages skipped due to zmq_errno() == EAGAIN)

int flags = 0;
// id of client (used for reply)
idSize = ::zmq_recv( socket, id, sizeof( id ), 0 );
idSize = ::zmq_recv( socket, id, sizeof( id ), flags );
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this still needed or just a debugging artefact?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, just found it below.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually no, the assignment below has no side effect due to the scope of flags?

Copy link
Author

Choose a reason for hiding this comment

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

You're right, this assignment has no effect, yet I was sure it had solved the last of my problems when I did it. I'll remove it and test everything again on Friday.

@eile
Copy link
Contributor

eile commented Sep 8, 2016

Can you merge the #157 test into this PR?

@eile
Copy link
Contributor

eile commented Sep 8, 2016

+1 otherwise

@eile
Copy link
Contributor

eile commented Sep 8, 2016

@favreau had also seen the Peer-Address msg, iirc.

@rdumusc
Copy link
Author

rdumusc commented Sep 9, 2016

retest this please

Unexpected "Peer-Address" or empty messages caused Tide's RestServer to block
in receive() after each http request in zmq_recv() at line 144 of
zeroeq/http/server.cpp. Such messages did not occur with libzmq 4.0.4.

This pathch ensure that none of the following unit tests block indefinitely:
- zeroeq/http/server - issue157
- tide/cpp/core/RestServerTests - testServerReturnsSimpleContent

and that normal receive operations (as tested with Tide's REST interface)
work as expected on Ubuntu 14.04, 16.04 and OSX.
@rdumusc
Copy link
Author

rdumusc commented Sep 9, 2016

Updated with a fix that I think is cleaner and has been tested on all platforms. I don't know how this could be specifically unit tested, however.

@eile
Copy link
Contributor

eile commented Sep 12, 2016

Gah, this is the kind of $#@! I wanted to avoid with zmq - Collage has similarly nice code. At least we're one level higher now at the http protocol (as opposed to tcp).

@eile eile merged commit aa52615 into HBPVIS:master Sep 12, 2016
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

Successfully merging this pull request may close these issues.

3 participants