Skip to content

Fix deadlock when handling simultaneous messages. #4327

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 1 commit into from
Nov 17, 2022
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
5 changes: 4 additions & 1 deletion firebase-messaging/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Unreleased

# 23.1.1

* [fixed] Fixed deadlock when handling simultaneous messages.

# 23.1.0
* [unchanged] Updated to accommodate the release of the updated
[messaging_longer] Kotlin extensions library.


## Kotlin
The Kotlin extensions library transitively includes the updated
`firebase-messaging` library. The Kotlin extensions library has the following
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ static void sendWakefulServiceIntent(
wakeLock.acquire(WAKE_LOCK_ACQUIRE_TIMEOUT_MILLIS);
}

connection
.sendIntent(intent)
.addOnCompleteListener(Runnable::run, t -> completeWakefulIntent(intent));
connection.sendIntent(intent).addOnCompleteListener(t -> completeWakefulIntent(intent));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.shadows.ShadowLooper;
import org.robolectric.shadows.ShadowPowerManager;

@RunWith(RobolectricTestRunner.class)
Expand Down Expand Up @@ -77,6 +78,7 @@ public void testSendWakefulServiceIntent_ReleasesWakeLock() {
WakeLock wakeLock = ShadowPowerManager.getLatestWakeLock();
taskCompletionSource.setResult(null);

ShadowLooper.idleMainLooper();
assertThat(wakeLock.isHeld()).isFalse();
}

Expand Down