Skip to content

[dwds] Race condition when establishing a tab connection and processing socket connections/requests in eval tests. #2298

Closed
@Markzipan

Description

@Markzipan

To reproduce:

Add Future.delayed(Duration(seconds: 3)) (or equivalent) just before the line containing getTab (between 404 and 405).
Then run https://github.com/dart-lang/webdev/blob/master/dwds/test/frontend_server_evaluate_sound_test.dart

Observation:

The test times out waiting for a connection. If you enable debug mode on the test, you can see that the test is still running in the chrome window (prints in a loop forever), but it's never "discovered" by the test framework.

I'm still doing some investigation, but it appears there's some interleaving execution-order dependency effect between this logic and establishing a tab connection.

This means changing the async characteristics of any code in either of these two pathways can lock the program. We seem to depend on logic in both pathways executing partially (but not fully) and in a particular order. You can see an early attempt at fixing this in this PR.

I've only observed this when running tests (so far).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions