Description
Using the vm service package it should be possible to use the reloadSources
to hot reload an Isolate from changes made to the src file on disk.
With current master of the Dart SDK this seems to work fine using the DartVM in JIT mode on the commandline with the main isolate but not with any isolate's spawned from the main isolate.
This seems to have been reported in several different Flutter issues:
- Hot reloaded changes are not applied to new isolates as they are launched flutter/flutter#18600
- Hot Reload does not update background isolate flutter/flutter#20743
This was supposedly fixed for Flutter in this change as part of flutter/flutter#52149 but I don't see how that could actually be working at the moment as I am seeing that it doesn't work with just the standalone Dart SDK.
I created a modified version of the recharge package that demonstrates this issue.
To reproduce:
- clone the above repo and use the
background-isolate-test
branch, run:dart --enable-vm-service example/hello.dart
- edit
hello.dart
changing the value returned bymesg()
and the print insideworker()
- note the pid printed out from step 1 and send it a sigusr1, eg
kill -n 10 <pid-of-example>
- notice that the output will show the new value of
mesg()
but NOT of the worker'sprint()
The version I have been testing with is built locally:
dart --version
Dart SDK version: 2.12.0-edge.30c4006d52fad4ee8b92025933b9f17af7a8740f (be) (Thu Dec 31 00:48:50 2020 +0000) on "linux_x64"