Skip to content

Handle error when stream was cancelled prior to calling halfClose. #6894

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 2 commits into from
Apr 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions firebase-firestore/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased
* [fixed] Fixed the `null` value handling in `whereNotEqualTo` and `whereNotIn` filters.
* [fixed] Catch exception when stream is already cancelled during close. [#6894](//github.com/firebase/firebase-android-sdk/pull/6894)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest rewording this changelog entry to call out the issue that the customer would experience that is fixed, maybe something like

Fix intermittent IllegalStateException: "call was cancelled" when closing Firestore


# 25.1.3
* [fixed] Use lazy encoding in UTF-8 encoded byte comparison for strings to solve performance issues. [#6706](//github.com/firebase/firebase-android-sdk/pull/6706)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,21 @@ private void close(State finalState, Status status) {
getClass().getSimpleName(),
"(%x) Closing stream client-side",
System.identityHashCode(this));
call.halfClose();
try {
call.halfClose();
} catch (IllegalStateException e) {
// Secondary failure encountered. The underlying RPC has entered an error state. We will
// log and continue since the RPC is being discarded anyway.
//
// Example, "IllegalStateException: call was cancelled" was observed in
// https://github.com/firebase/firebase-android-sdk/issues/6883
// Likely caused by other part of system already cancelling stream.
Logger.debug(
getClass().getSimpleName(),
"(%x) Closing stream client-side result in exception: [%s]",
System.identityHashCode(this),
e);
}
}
call = null;
}
Expand Down
Loading