Commit Detail
Commit d3dfab5
Flush pending microtasks on service worker startup Service-worker format scripts (non-module) did not flush the V8 microtask queue after top-level evaluation in the Worker constructor. When two Workers sharing an isolate (same script, different zones) are constructed sequentially, and leave pending microtasks on the shared per-isolate queue, the first request's microtask checkpoint will then drain microtasks from both contexts, executing the other Worker's callbacks under the wrong IoContext — causing things like `TimeoutId::Generator`` mismatch assertions and potential cross-context state corruption. The fix is to call `lock.runMicrotasks()` after `NonModuleScript::run()`, matching the module path. A test in workerd (either C++ or wd-test) is currently not possible so the regression test will be added to the internal project.
Files changed
1 file changed~1 modified