Repository navigation
[google_maps_flutter_web] Don't hang onMapCreated when tiles fail to load - #13059
Conversation
…load The map was only reported as ready on the first 'tilesloaded' event, which never fires if a tile request stalls or fails. Also accept the first 'idle' event once the map div is laid out. Integration tests now time out waiting for the map instead of hanging until the driver fails with an opaque DriverError. Fixes flutter/flutter#193452
There was a problem hiding this comment.
Code Review
This pull request modifies the web implementation of the Google Maps Flutter plugin to ensure that onMapCreated is called even if a map tile fails to load. It updates _attachMapEvents in GoogleMapController to trigger the map-ready event using either the first tilesloaded event or the first idle event after the map's div is connected and has a positive width. Additionally, integration tests are updated to use a new helper function, waitForMap, which adds a 30-second timeout to map-creation futures to prevent test hangs. Feedback suggests also checking offsetHeight in addition to offsetWidth to guarantee the map is fully laid out and usable.
Records map lifecycle events, layout, pending tiles and Maps network activity; dumps them when waitForMap times out, and adds a stress test that measures idle vs tilesloaded across many fresh maps. For flutter/flutter#193452
onMapCreated when tiles fail to load
|
To check whether this actually removes the hang rather than just making it rarer, I ran the Results: 59 builds, 309 cold-start build-equivalents, 2,880 instrumented Caveat: the historical failures cluster by date (3 on 2026-09-25), so the builds are not fully independent and this is an upper bound on confidence. I also never caught a stalled All builds: All 59 shard_1 builds
|
…gration tests (#13092) Split out from #13059. Integration tests have no default timeout, so when a map fails to initialize on CI, the test hangs until `flutter drive` gives up after 20 minutes with an opaque `DriverError` and no browser state in the log. Also, tests that construct multiple `GoogleMapController` instances reused `mapId = 33930`, which collides in `platformViewRegistry.registerViewFactory` so `controller.widget` renders the first test's `<div>`. - Add `pumpMap` and `pumpPlatformMap` helpers that bound map creation to 30s and dump the Maps SDK / DOM `<div>` state on timeout. - Add `getNextMapId()` so each test controller registers a unique platform view factory. - Set a 2-minute per-test timeout in the real-map suites and a 5-minute driver timeout in `test_driver/integration_test.dart`. - Fix `marker_clustering_test` waiting for `clusters.isNotEmpty` instead of `clusters.isEmpty` after removing all clusters. Part of flutter/flutter#193452
flutter/packages@618afba...1383427 2026-10-21 [email protected] [shared_preferences] Keep Kotlin classes used through JNI in Android release builds (flutter/packages#13311) 2026-10-20 [email protected] [webview_flutter_wkwebview] Roll back iOS and macOS versions (flutter/packages#13354) 2026-10-20 [email protected] [camera]fix resolution test failure due to hardware restriction (flutter/packages#13356) 2026-10-20 [email protected] [google_maps_flutter_web] Fail fast and deduplicate map setup in integration tests (flutter/packages#13092) 2026-10-20 [email protected] [camera_avfoundation] Fix Swift analyzer issues in tests (flutter/packages#13340) 2026-10-20 [email protected] Sync release-material_ui-1.8.0 to main (flutter/packages#13346) 2026-10-20 [email protected] [material_ui] add a `barFocusNode` to `SearchAnchor.bar` (ref: flutter#186073) (flutter/packages#12863) 2026-10-20 [email protected] [in_app_purchase_storekit] Expose sk2Transaction on SK2PurchaseDetails (flutter/packages#13341) 2026-10-20 [email protected] Sync release-cupertino_ui-1.1.4 to main (flutter/packages#13350) 2026-10-20 [email protected] [google_maps_flutter_web] Don't hang `onMapCreated` when tiles fail to load (flutter/packages#13059) 2026-10-20 [email protected] [material_ui] Unskip web tests that pass on CanvasKit and Skwasm: adaptive_text_selection_toolbar_test, material_button_test, outlined_button_test, text_button_test (flutter/packages#13335) 2026-10-20 [email protected] Sync release-go_router-18.1.1 to main (flutter/packages#13347) 2026-10-20 [email protected] [camera] Add zero-shutter-lag support to camera_android_camerax and camera_avfoundation (flutter/packages#13199) 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
The map was reported as ready only on the first `tilesloaded` event, which requires every visible tile to finish downloading. A single stalled or failed tile request left `onMapCreated` pending forever. Also report the map as ready on the first `idle` event once the map div has a non-zero size, as google_maps_flutter_web does. Upstream: flutter/packages#13059 (google_maps_flutter_web 0.6.4+2, flutter/flutter#193452)
flutter/packages@618afba...1383427 2026-10-21 [email protected] [shared_preferences] Keep Kotlin classes used through JNI in Android release builds (flutter/packages#13311) 2026-10-20 [email protected] [webview_flutter_wkwebview] Roll back iOS and macOS versions (flutter/packages#13354) 2026-10-20 [email protected] [camera]fix resolution test failure due to hardware restriction (flutter/packages#13356) 2026-10-20 [email protected] [google_maps_flutter_web] Fail fast and deduplicate map setup in integration tests (flutter/packages#13092) 2026-10-20 [email protected] [camera_avfoundation] Fix Swift analyzer issues in tests (flutter/packages#13340) 2026-10-20 [email protected] Sync release-material_ui-1.8.0 to main (flutter/packages#13346) 2026-10-20 [email protected] [material_ui] add a `barFocusNode` to `SearchAnchor.bar` (ref: flutter#186073) (flutter/packages#12863) 2026-10-20 [email protected] [in_app_purchase_storekit] Expose sk2Transaction on SK2PurchaseDetails (flutter/packages#13341) 2026-10-20 [email protected] Sync release-cupertino_ui-1.1.4 to main (flutter/packages#13350) 2026-10-20 [email protected] [google_maps_flutter_web] Don't hang `onMapCreated` when tiles fail to load (flutter/packages#13059) 2026-10-20 [email protected] [material_ui] Unskip web tests that pass on CanvasKit and Skwasm: adaptive_text_selection_toolbar_test, material_button_test, outlined_button_test, text_button_test (flutter/packages#13335) 2026-10-20 [email protected] Sync release-go_router-18.1.1 to main (flutter/packages#13347) 2026-10-20 [email protected] [camera] Add zero-shutter-lag support to camera_android_camerax and camera_avfoundation (flutter/packages#13199) 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
flutter/packages@618afba...1383427 2026-10-21 [email protected] [shared_preferences] Keep Kotlin classes used through JNI in Android release builds (flutter/packages#13311) 2026-10-20 [email protected] [webview_flutter_wkwebview] Roll back iOS and macOS versions (flutter/packages#13354) 2026-10-20 [email protected] [camera]fix resolution test failure due to hardware restriction (flutter/packages#13356) 2026-10-20 [email protected] [google_maps_flutter_web] Fail fast and deduplicate map setup in integration tests (flutter/packages#13092) 2026-10-20 [email protected] [camera_avfoundation] Fix Swift analyzer issues in tests (flutter/packages#13340) 2026-10-20 [email protected] Sync release-material_ui-1.8.0 to main (flutter/packages#13346) 2026-10-20 [email protected] [material_ui] add a `barFocusNode` to `SearchAnchor.bar` (ref: flutter#186073) (flutter/packages#12863) 2026-10-20 [email protected] [in_app_purchase_storekit] Expose sk2Transaction on SK2PurchaseDetails (flutter/packages#13341) 2026-10-20 [email protected] Sync release-cupertino_ui-1.1.4 to main (flutter/packages#13350) 2026-10-20 [email protected] [google_maps_flutter_web] Don't hang `onMapCreated` when tiles fail to load (flutter/packages#13059) 2026-10-20 [email protected] [material_ui] Unskip web tests that pass on CanvasKit and Skwasm: adaptive_text_selection_toolbar_test, material_button_test, outlined_button_test, text_button_test (flutter/packages#13335) 2026-10-20 [email protected] Sync release-go_router-18.1.1 to main (flutter/packages#13347) 2026-10-20 [email protected] [camera] Add zero-shutter-lag support to camera_android_camerax and camera_avfoundation (flutter/packages#13199) 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
The map was reported as ready only on the first `tilesloaded` event, which requires every visible tile to finish downloading. A single stalled or failed tile request left `onMapCreated` pending forever. Also report the map as ready on the first `idle` event once the map div has a non-zero size, as google_maps_flutter_web does. Upstream: flutter/packages#13059 (google_maps_flutter_web 0.6.4+2, flutter/flutter#193452)
The web plugin reported a map as ready (triggering
onMapCreated) only on the firsttilesloadedevent. That event requires every visible tile to download, so a single stalled or failed tile request leavesonMapCreatedpending forever. On CI, this hangsprojection_test,overlays_test, andmarker_clustering_testuntilflutter drivefails with an opaqueDriverErrorafter 20 minutes.Example CI failures:
https://ci.chromium.org/b/8669392206413648801
https://ci.chromium.org/b/8669672566864354113
Report the map as ready on the first
tilesloadedor the firstidleevent once the map<div>is attached and has a non-zero size, when the projection and bounds are available.Re-enable the tests skipped in [google_maps_flutter] Disable flaky web tests blocking latest flutter -> packages roll #13047.
Fixes flutter/flutter#193452