Skip to content

UNREACHABLE in WorkerThreadsTaskRunner::PostDelayedTask #22157

Description

@devsnek

v8_inspector::V8InspectorImpl::EvaluateScope::setTimeout calls
NodePlatform::CallDelayedOnWorkerThread which calls
WorkerThreadsTaskRunner::PostDelayedTask which has UNREACHABLE().

any calls to Runtime.evaluate with a timeout will therefore abort the process...

/cc @addaleax @TimothyGu

Activity

  1. added
    inspectorIssues and PRs related to the V8 inspector protocol.
    on Aug 6, 2018
  2. changed the title [-]UNREACHABLE in NodePlatform::CallDelayedOnWorkerThread[/-] [+]UNREACHABLE in WorkerThreadsTaskRunner::PostDelayedTask[/+] on Aug 6, 2018
  3. devsnek commented on Aug 6, 2018

    @devsnek
    MemberAuthor

    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() {
  4. addaleax commented on Aug 6, 2018

    @addaleax
    Member

    @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?

  5. devsnek commented on Aug 6, 2018

    @devsnek
    MemberAuthor

    @addaleax i think i'll just leave this to someone who knows more about it :P

  6. added
    v8 engineIssues and PRs related to the V8 dependency.
    on Aug 6, 2018
  7. addaleax commented on Aug 6, 2018

    @addaleax
    Member

    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

  8. added
    help wantedIssues that need assistance from volunteers or PRs that need help to proceed.
    on Aug 6, 2018
  9. alexkozy commented on Aug 17, 2018

    @alexkozy
    Member

    It looks like this crash is reproducible in Node 10.9.0 and it breaks DevTools console in dedicated frontend and in ndb.
    I am wondering what is right label to mark issues like this next time to make it release blocker? I will work on fix tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedIssues that need assistance from volunteers or PRs that need help to proceed.inspectorIssues and PRs related to the V8 inspector protocol.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions