dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.23k stars 1.57k forks source link

VM Service should finish processing RPC responses from service extensions before shutting down #56831

Open bkonyi opened 1 month ago

bkonyi commented 1 month ago

It's possible for the VM to shutdown immediately after the main isolate returns from a service extension if there's no longer any events in the queue and no ports remain open. This can cause a race where the VM starts to shutdown as the service isolate is in the middle of processing the service extension response, preventing the VM service client from actually getting the service extension result.

We should investigate whether or not it's possible to prevent the service isolate from shutting down while it's in the middle of processing a response.

bkonyi commented 1 month ago

@rmacnak-google can you think of any reason why this wouldn't be feasible or would otherwise be a bad idea?

rmacnak-google commented 1 month ago

Seems reasonable. We'd need to make sure we're only waiting to finish the pending outgoing responses and not accepting new requests or we risk never actually reaching shutdown.