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

API-7698: Fix possible issue with connection becoming stalled after interrupt during call.execute #107

Merged
merged 6 commits into from
May 28, 2024

Conversation

sbogolii-sift
Copy link
Contributor

@sbogolii-sift sbogolii-sift commented May 24, 2024

Purpose

Our customer experiences SocketTimeoutException with sift-java.
Overall it looks like this is still an open issue with okhttp.

Technical details

Seems, When using Call.execute() which is synchronous, the actual initial request processing including writing to the HTTP/2 socket is done on the calling thread, so an interrupt leaves the HTTP/2 connection in an inconsistent state.

Workarounds:

  1. set the connectionPool in the builder so it uses a new connection pool w/ a size of zero
  2. turn off HTTP/2 support by setting a new protocolList in the builder with only HTTP/1.1 support.

Another workaround with implementation proposed -
always use enqueue, even to simulate an execute so the thread writing the underlying socket is never a user thread that can be interrupted.

Seems this is the most optimal fix, and will be implemented in this PR.
With the current fix siftClient. enqueueRequests() will use enqueue instead of execute

@sbogolii-sift sbogolii-sift requested review from a team May 24, 2024 10:35
@sbogolii-sift
Copy link
Contributor Author

/jenkins-test

@sbogolii-sift sbogolii-sift merged commit 89b106c into master May 28, 2024
2 checks passed
@sbogolii-sift sbogolii-sift deleted the API-7698 branch May 28, 2024 09:04
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