Skip to content

[dwds] WebkitDebugger.enable 5-second hardcoded timeout causes TimeoutException on large web apps #2883

Open

Description

@Lalith2212

Problem
In package:dwds/src/debugging/webkit_debugger.dart, WebkitDebugger.enable() has a hardcoded 5-second timeout on _wipDebugger.enable().

On large enterprise Flutter Web applications (with dozens of dependencies and heavy generated source maps), Chrome's remote debugging protocol (Debugger.enable) takes between 8–15 seconds to finish its initial source-map parse and handshake under normal CPU loads.

Because of the rigid 5-second limit, flutter run -d chrome crashes deterministically on startup with:
Failed to establish connection with the web debug service: TimeoutException after 0:00:05.000000: Future not completed #0 Future.timeout (dart:async/future_impl.dart) #1 WebkitDebugger.enable (package:dwds/src/debugging/webkit_debugger.dart:166:9)

Image **Before this version:** In previous versions of DWDS (e.g. 25.x), enable() awaited _wipDebugger.enable() without a timeout, which allowed Chrome sufficient time to attach.

Activity

  1. added
    type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)
    P1A high priority bug; for example, a single project is unusable or has many test failures
    on Oct 28, 2026
  2. nshahan commented on Oct 28, 2026

    @nshahan
    Contributor

    The timeout was added in #2747

    cc @Markzipan

  3. Lalith2212 commented on Oct 29, 2026

    @Lalith2212
    Author

    Thank you @nshahan for triaging this as P1 and linking #2747
    To provide more context for @Markzipan:
    Why 5 seconds is too aggressive in practice:
    In enterprise-scale Flutter Web applications (which often contain 40+ packages and large source maps):
    When Chrome receives the CDP command Debugger.enable, it must synchronously parse and index all loaded scripts and source maps.
    On real developer workstations under normal load, this initial indexing step consistently takes 8 to 15 seconds.
    Because the timeout is hardcoded to 5 seconds, each of the 3 retry attempts fails before Chrome can even finish its first parse, leading to a guaranteed TimeoutException.

  4. self-assigned this
    on Oct 29, 2026
  5. Markzipan commented on Oct 29, 2026

    @Markzipan
    Contributor

    Thanks for isolating this @Lalith2212! We can land a fix on our end (as DWDS moved to our SDK somewhat recently).

  6. Lalith2212 commented on Oct 30, 2026

    @Lalith2212
    Author

    Thank you @Markzipan and @nshahan for the quick response and for taking ownership of this!
    Could you please link the SDK commit / PR here once it is ready so we can track its progress? Also, do you anticipate this fix being included in an upcoming stable patch or the next minor SDK release?
    Happy to help test the build as soon as it's available.

  7. Markzipan commented on Nov 3, 2026

    @Markzipan
    Contributor

    No worries - and sorry about the churn here. Can you check out flutter channel master after this PR lands? flutter/flutter#195932

    If that works, I can try to get a cherrypick into beta/stable sooner.

    It should have the timeout bug fixes.

  8. Lalith2212 commented on Nov 4, 2026

    @Lalith2212
    Author

    Awesome news! Thank you @Markzipan for landing the fix in dart-lang/sdk (commit 20bae76).
    I will monitor flutter/flutter#195932. As soon as that lands, I will test it on channel master with our app and confirm back here.
    Getting a cherry-pick into stable would be amazing. Thank you!

  9. Lalith2212 commented on Nov 4, 2026

    @Lalith2212
    Author

    Hey @Markzipan and @nshahan,
    Thanks a ton for this!
    I went through the new code in webkit_debugger.dart — handling it with the 3-minute window and Future.any is super neat, definitely way better and cleaner than just bumping the timer.
    Tested it out on our project and it's working great now. Chrome connects right away on startup with zero timeout crashes.
    Please go ahead with the cherry-pick to beta/stable whenever you can. It's going to save a lot of folks working on big web apps from this headache!

    Image

    Really appreciate how fast you guys jumped on this and sorted it out. Thanks again!

  10. nshahan commented on Nov 6, 2026

    @nshahan
    Contributor

    @Markzipan
    A new test failure on the windows config with this fix. dart-lang/sdk#64869

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1A high priority bug; for example, a single project is unusable or has many test failurespackage:dwdstriagedtype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions