Skip to content

net: do not close socket on EWOULDBLOCK, as this can happen during cursor iteration #182

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

Merged
merged 1 commit into from
Apr 6, 2020

Conversation

tommilligan
Copy link
Contributor

Reason for the change

When calling .next(wait=False) on a cursor, ReqlTimeoutError is raised if the query would block. This is expected and documented behaviour.

However, introduced in 9fbd6f2, this will also close the underlying socket, preventing .next() from being called again on the cursor.

This is unexpected behaviour; we would like to be able to continue listening for new changes in a cursor, even after one request has timed out.

Description

  • net: Do not close underlying socket connection if EWOULDBLOCK received
  • tests/integration: Add test case that reproduces the issue (fails against master)

Code examples

See the added test for an example.

Checklist

  • Unit tests created/modified N/A
  • Integration tests created/modified

References

Documentation detailing the behaviour of next and wait can be found here: https://rethinkdb.com/api/python/next/

@gabor-boros
Copy link
Member

@tommilligan Very nice catch! Thanks 🙏

@gabor-boros gabor-boros merged commit 3911023 into rethinkdb:master Apr 6, 2020
@gabor-boros
Copy link
Member

I'll release this today/tomorrow

@tommilligan
Copy link
Contributor Author

No problem - to be honest it's only something we've run into when writing integration tests, as that's where we generally set wait=False. But I guess it would've turned up sooner or later at runtime.

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.

2 participants