Repository navigation
[pigeon] Fix race in event channel handler removal integration test - #13528
auto-submit[bot] merged 1 commit into
Conversation
The test plugin removed the stream handler for instance "1" immediately after calling endOfStream. Closing the stream makes the Dart side send a "cancel" call on the channel, which then raced with the removal and failed with a MissingPluginException, closing the tree. Remove the handler from onCancel instead, after the "cancel" call has been received.
There was a problem hiding this comment.
Code Review
This pull request modifies the Android and iOS test plugins to handle stream cancellation instead of stream completion. In both Kotlin and Swift implementations, the onCompleted callbacks are replaced with onCancelled callbacks, and the stream handler removal is moved to the onCancel method to prevent a race condition with the Dart-side cancel call. There are no review comments, and I have no feedback to provide.
|
@tarrinneal @stuartmorgan-g This fixes the current tree breakage in |
elliette
left a comment
There was a problem hiding this comment.
Approving on behalf of Plugins gardener rotation, this fixes flutter/flutter#195804 which is breaking flutter -> packages autorolls.
|
This also fixes the tree breakage, adding |
|
Detected the If you add the The "Merge" button is also unlocked. To bypass presubmits as well as the tree status, press the GitHub "Add to Merge Queue". |
|
Thank you for the fix @mmohankrishna-lab! It was great to find this already fixed this morning. |
flutter/packages@3f34a6f...1df8447 2026-11-03 [email protected] [webview_flutter] Convert iOS impl example app to Swift (flutter/packages#13538) 2026-11-03 [email protected] [material_ui] Temporarily exclude material_ui from non-Wasm web unit tests (flutter/packages#13537) 2026-11-02 [email protected] [material_ui] Removes list semantics in some a11y_assessment samples (flutter/packages#13257) 2026-11-02 [email protected] [material_ui] Use named uniforms instead of setFloat in InkSparkle (flutter/packages#13445) 2026-11-02 [email protected] [VPAT] Fix contrast and reflow in three a11y_assessments demos (flutter/packages#13409) 2026-11-02 [email protected] [two_dimensional_scrollables] Fix pinned cells hit test (flutter/packages#13376) 2026-11-02 [email protected] [tool] Let the OS pick a port for chromedriver and wait for exit (flutter/packages#13355) 2026-11-02 [email protected] [vector_graphics] Draw <text> under an RTL ambient direction (flutter/packages#13408) 2026-11-02 [email protected] [VPAT] Keep a11y_assessments snackbars open until closed (flutter/packages#13451) 2026-11-02 [email protected] [pigeon] Fix race in event channel handler removal integration test (flutter/packages#13528) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
This PR fixes the tree.
Linux_android custom_package_tests masteris failing onmain(all 3 attempts of #4084) in the Pigeon integration testevent channels handle multiple instances:Cause
The test plugin unregisters the stream handler for instance
"1"(to exercise event channel unregistration, added in #13438) immediately after callingendOfStream(). On the Dart side, the end of the stream closes theEventChannel's broadcast stream, which then sends acancelmethod call back on the same channel. If the handler has already been removed by the time thatcancelcall arrives, it fails with aMissingPluginException, which fails the test. Whether it fails depends on timing, so it shows up as a flake.Fix
Unregister the handler from the stream handler's
onCancelinstead, i.e. only after thecancelcall has been received, in both the Kotlin (Android) and Swift (iOS/macOS) test plugins. The generated Pigeon stream handler wrappers already forward the platformonCancelto the user handler, so no generator or generated-code changes are needed. The test still exercises unregistration; it just no longer races with the channel teardown.This only changes test plugin code under
platform_tests/, so there is no change to the published package.Testing
On an Android emulator (Pixel 9a), running only
event channels handle multiple instances:MissingPluginExceptiononcancel)main)The full
android_kotlin_integration_testssuite (680 tests) also passes with this fix, as dodart_unittestsandflutter_unittests. The Swift change mirrors the Kotlin one and is covered by the iOS/macOS integration tests in CI.Related
flutter/flutter#179154 tracks a different flake in the same test on macOS Swift (
Bad state: Cannot add new events after calling close, i.e. an event sent afterendOfStream). This PR does not address that one, and the macOS Swift skip is left in place.Pre-Review Checklist
[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2