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

Receiver: return after timeout even if more data is pending #218

Merged
merged 2 commits into from
Jul 18, 2017

Conversation

eile
Copy link
Contributor

@eile eile commented Jul 17, 2017

No description provided.

@@ -2,6 +2,8 @@

# git master

* [218](https://github.com/HBPVIS/ZeroEQ/pull/218):
Fix infinite loop in slow receivers
Copy link
Contributor

Choose a reason for hiding this comment

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

more like "with very fast sender(s)"

const uint32_t remaining =
duration_cast<milliseconds>(high_resolution_clock::now() -
startTime)
.count();
Copy link
Contributor

Choose a reason for hiding this comment

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

nice formatting :)

@eile eile merged commit d407b1d into HBPVIS:master Jul 18, 2017
@rdumusc
Copy link

rdumusc commented Jul 28, 2017

@eile @tribal-tec this commit breaks the http server in Tide, which is based on QSocketNotifier. I don't understand what you were trying to achieve here. Doing a non-blocking receive() using timeout=0 is not allowed anymore? Please advise.

@eile
Copy link
Contributor Author

eile commented Jul 28, 2017

Seems there is no test for this. :P

This PR fixed that if the publisher is faster than the subscriber, a subscriber.receive(timeout) would never return, even after the timeout expired.

This changes the behaviour of receive(0) which now will do one receive, not all (which is in line with the doc/spec).

Not sure why/how this breaks the QSocketNotifier.

@rdumusc
Copy link

rdumusc commented Jul 28, 2017

OK, part of the problem is that the timeout is now used for two purposes:

  • a poll timeout (waiting x milliseconds until SOME data arrives)
  • a processing timeout (abort after processing TOO MUCH data)

I think the reason it breaks in Tide is because the zmq socket notifies only once data first arrives (edge triggered), not as long as there is data to read (level triggered). So now it only processes one message, exceeds the limit of 0 millisecond and stops instead of reading all messages.

@tribal-tec
Copy link
Contributor

Wouldn't while(receive(0)); solve it then in Tide to process all pending?

@rdumusc
Copy link

rdumusc commented Jul 28, 2017

seeing that receive() returns false when no messages were processed probably yes, I will test that next week

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