[flutter_tools] alternate the name of the dill file used for hot restart#65435
Conversation
|
FYI @aam |
|
@zanderso do you have any concerns about this? from my understanding what we're doing today is technically not safe, though unlikely to crash. |
zanderso
left a comment
There was a problem hiding this comment.
bikeshed: instead of 'left' how about just '1' and '0'? Or maybe 'swap' or 'secondary'?
Is the real fix a lot more involved? I would think that Restart should be doing something like:
- stop execution
- unmap the old dill
- map the new dill
- restart
Do we know how/why that goes wrong?
|
swap sounds good. For a real fix, yes I think we'd have to stop the main isolate before uploading the new dill and restarting. I can foresee some issues though because the main isolate lifecycle is tied to the service isolate and application lifecycle, so simply using the existing vm_service API is not sufficient. We'd need a new set of vm_service APIs provided by the engine that essentially split the hot restart process in half, one to take down the main isolate (while keeping everything else alive) and one to resurrect it with the newly uploaded dill. I'm not sure how difficult that would be to do. Fyi @chinmaygarde @jason-simmons |
Description
The engine memory maps the dill file used to run the Dart isolate. Replacing this file before hot restart is not technically safe, though is unlikely to crash. Nevertheless, the protection applied by the windows mapping prevents replacing the file.
Update hot restart so that the uploaded file name alternates -> main.dart.dill -> main.dart.swap.dill > main.dart.dill to prevent replacing the mapped dill and to avoid filling up the devFS.
Context:
https://github.com/flutter/engine/blob/master/fml/platform/win/mapping_win.cc#L73
Fixes #60910