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

fix: properly set cancel socket timeout #2044

Merged
merged 1 commit into from Feb 16, 2021

Conversation

Powerrr
Copy link
Contributor

@Powerrr Powerrr commented Jan 31, 2021

If we set a socket timeout on PGStream's socket, but don't set PGStream.pgInput.timeoutRequested to true, then PGStream.pgInput will ignore SocketTimeoutExceptions (VisibleBufferedInputStream.java#L169) and the timeout effectively doesn't work.

PGStream.setNetworkTimeout() sets both the timeout and the timeoutRequested field.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Existing Features:

  • Does this break existing behaviour? If so please explain.
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?

@davecramer
Copy link
Member

Is there a way to test this ? Seems it wasn't working before and we didn't catch it. I'd like to see a test added to this to ensure that we don't break it in the future

@Powerrr
Copy link
Contributor Author

Powerrr commented Feb 2, 2021

Yes, we can test this. Added a test to check that cancel() doesn't hang forever.

@Powerrr
Copy link
Contributor Author

Powerrr commented Feb 16, 2021

Any news?

@vlsi
Copy link
Member

vlsi commented Feb 16, 2021

This PR looks good to me.
timeoutRequested is indeed surprising

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.

None yet

4 participants