-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
UNREACHABLE in WorkerThreadsTaskRunner::PostDelayedTask #22157
Comments
would this diff work? its sorta copied from the foreground runner's PostDelayedTask diff --git a/src/node_platform.cc b/src/node_platform.cc
index 6a3ae2e5dc..c41e6624e8 100644
--- a/src/node_platform.cc
+++ b/src/node_platform.cc
@@ -46,7 +46,15 @@ void WorkerThreadsTaskRunner::PostTask(std::unique_ptr<Task> task) {
void WorkerThreadsTaskRunner::PostDelayedTask(std::unique_ptr<v8::Task> task,
double delay_in_seconds) {
- UNREACHABLE();
+ uv_timer_t timer;
+ timer.data = std::move(task).get();
+ uint64_t delay_millis = static_cast<uint64_t>(delay_in_seconds + 0.5) * 1000;
+ uv_timer_init(uv_default_loop(), &timer);
+ uv_timer_start(&timer, [](uv_timer_t* timer) {
+ auto task = reinterpret_cast<v8::Task*>(timer->data);
+ task->Run();
+ }, delay_millis, 0);
+ uv_unref(reinterpret_cast<uv_handle_t*>(&timer));
}
void WorkerThreadsTaskRunner::BlockingDrain() { |
@devsnek Well … accessing the default loop is not thread-safe (and that loop does not run in the background). So, for that general approach to work, I think we’d need to have a separate loop/thread for the delayed tasks? |
@addaleax i think i'll just leave this to someone who knows more about it :P |
I think I’m working on enough things for now, but if somebody wants to take this and feels up for it, I’m happy to support as needed |
It looks like this crash is reproducible in Node 10.9.0 and it breaks DevTools console in dedicated frontend and in ndb. |
This method is crucial for Runtime.evaluate protocol command with timeout flag. At least Chrome DevTools frontend uses this method for every execution in console. Backport-PR-URL: #22567 PR-URL: #22383 Fixes: #22157 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
This method is crucial for Runtime.evaluate protocol command with timeout flag. At least Chrome DevTools frontend uses this method for every execution in console. Backport-PR-URL: #22567 PR-URL: #22383 Fixes: #22157 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
This method is crucial for Runtime.evaluate protocol command with timeout flag. At least Chrome DevTools frontend uses this method for every execution in console. Backport-PR-URL: #22567 PR-URL: #22383 Fixes: #22157 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
This method is crucial for Runtime.evaluate protocol command with timeout flag. At least Chrome DevTools frontend uses this method for every execution in console. PR-URL: nodejs#22383 Fixes: nodejs#22157 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
v8_inspector::V8InspectorImpl::EvaluateScope::setTimeout
callsNodePlatform::CallDelayedOnWorkerThread
which callsWorkerThreadsTaskRunner::PostDelayedTask
which hasUNREACHABLE()
.any calls to
Runtime.evaluate
with a timeout will therefore abort the process.../cc @addaleax @TimothyGu
The text was updated successfully, but these errors were encountered: