Skip to content

Fix race condition on simultaneous hot restarts #1870

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 14 commits into from
Jan 10, 2023

Conversation

annagrin
Copy link
Contributor

@annagrin annagrin commented Jan 6, 2023

Make hot restarts atomic

  • Replace uses of Pool(1) by an AtomicQueue wrapper for clarity.
  • Execute hot restart service extension atomically.
  • Add test for simultaneous hot restarts.

Towards: #1869

Anna Gringauze added 4 commits January 4, 2023 15:41
- Fix race condition on running two `createIsolate` calls simultaneously.
  - Run `destroyIsolate` followed by `createIsolate` an atomic operation.
  - Make debugger API that depend on isolate running wait for the start
    of the app.
  - Make debugger API throw if the isolate exits while the API is waiting.
- Fix exception on uninitialized `DwdsStats._devToolsStart` when using
  an observatory uri to connect to the dwds VM service.
- Remove unnecessary async keywords from synchronoous debugger API.

Closes: ihttps://github.com/dart-lang/issues/1869
- Fix race condition on running two `createIsolate` calls simultaneously.
  - Run `destroyIsolate` followed by `createIsolate` an atomic operation.
  - Make debugger API that depend on isolate running wait for the start
    of the app.
  - Make debugger API throw if the isolate exits while the API is waiting.
- Fix exception on uninitialized `DwdsStats._devToolsStart` when using
  an observatory uri to connect to the dwds VM service.
- Remove unnecessary async keywords from synchronoous debugger API.

Closes: ihttps://github.com/dart-lang/issues/1869
@elliette
Copy link
Contributor

elliette commented Jan 9, 2023

Could we break this up a bit more?

PR 1, addressing #1869:

Fix race condition on running two createIsolate calls simultaneously:

  • Run destroyIsolate followed by createIsolate an atomic operation.
  • Return error on expression evaluation if the evaluator is closed.

PR 2, addressing #1704:

Make debugger API that depend on isolate running wait for the start
of the app.
Note: I think in that PR we should use the observer pattern as mentioned in #1870 (comment), as well as re-enable the tests that were disabled in #1751.

PR 3, cleanup:

Remove unnecessary async keywords from synchronous debugger API

@annagrin
Copy link
Contributor Author

Current PR breakup plan:

  1. Synchronize hot restart (this change)
  2. Make expression compiler reject requests if closed
  3. Update debugger and vm_service state machine to make sure they are in sync with each other
  4. Remove unnecessary async keywords from the debugger and re-enable getStack test

@annagrin annagrin requested a review from elliette January 10, 2023 18:26
Copy link
Contributor

@elliette elliette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one request - can we rename runTask to simply run (since from my understanding it will run all tasks in queue sequentially?)

@annagrin annagrin merged commit 3743293 into dart-lang:master Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants