Skip to content

Fix external cancels propagation in rxjava2 and rxjava3 adapters #4427

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

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

teqwve
Copy link

@teqwve teqwve commented Jul 11, 2025

Hi! It looks like there is a small bug in CallEnqueueObservable - external cancels (like timeouts) are not getting propagated to rxjava making calls stuck. It looks like when a separate "disposed" state was introduced 3f111b7 a one place in CallEnqueueObservable.onFailure was missed (while it was used in analogous place in catch inside CallExecuteObservable). This PR should fix the issue.

I tested it manually with rxjava3 and added simple tests that fail without the fix. This should resolve #3524.


  • CHANGELOG.md's "Unreleased" section has been updated, if applicable.

If OkHttp call is cancelled (e.g. because of a timeout) then error is
not passed to downstream resulting in a stuck rxjava invocation. Fix it
by using `disposed` instead of reusing OkHttp call cancelled state.

Separate state was added in 3f111b7,
for the same reason but it was not used in `CallEnqueueObservable`
`onFailure` while it should be (just like it was used in try-catch in
`CallExecuteObservable`).
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.

Async RxJava3 call adapter doesn't produce error event when request is canceled by timeout
1 participant