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

Document cancellation behaviour #7022

Closed
wants to merge 1 commit into from

Conversation

yschimke
Copy link
Collaborator

Relating to #7016.

Document the issue with interrupts.

@yschimke yschimke requested a review from swankjesse January 18, 2022 08:31
@swankjesse
Copy link
Collaborator

I think we should fix this rather than advising our users work around it?

Working around it is really hard for anyone canceling Futures that might transitively be performing OkHttp calls.

@yschimke yschimke closed this Jan 19, 2022
@yschimke
Copy link
Collaborator Author

@swankjesse +1Given the exception bubbles up from newStream to the caller through execute(), any pointers for how to address?

Exception in thread "Thread-11" java.io.InterruptedIOException: interrupted
	at okio.Timeout.throwIfReached(Timeout.kt:98)
	at okio.OutputStreamSink.write(JvmOkio.kt:54)
	at okio.AsyncTimeout$sink$1.write(AsyncTimeout.kt:99)
	at okio.RealBufferedSink.flush(RealBufferedSink.kt:267)
	at okhttp3.internal.http2.Http2Writer.flush(Http2Writer.kt:120)
	at okhttp3.internal.http2.Http2Connection.newStream(Http2Connection.kt:268)
	at okhttp3.internal.http2.Http2Connection.newStream(Http2Connection.kt:225)
	at okhttp3.internal.http2.Http2ExchangeCodec.writeRequestHeaders(Http2ExchangeCodec.kt:76)
	at okhttp3.internal.connection.Exchange.writeRequestHeaders(Exchange.kt:63)
	at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:41)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)```

a) Remove the stream + send rst_stream - and hope connection is healthy?
b) Assume connection is damaged and set noNewExchanges?
c) try to protect against this, avoid using the same user provided thread for an connection IO write?
d) try to minimise the window, make this effectively uninterruptible? Maybe requires support in Okio?
e) other?

@yschimke yschimke deleted the doc_interrupts branch May 27, 2023 11:23
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