nodejs/nan

Issue with SetWeak on V8 master

nornagon opened this issue · 1 comments

We encountered this issue on the Electron CI, which builds nan against latest V8:

not ok test/js/weak-test.js ............................. 0/1
    Command: "/home/builduser/project/src/out/Default/electron weak-test.js"
    TAP version 13
    not ok 1 test/js/weak-test.js
      ---
        exit:    ~
        signal:  SIGABRT
        stderr:  |
          FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope
           1: 0x55cc903da0e5  [/home/builduser/project/src/out/Default/electron]
           2: 0x55cc903da154  [/home/builduser/project/src/out/Default/electron]
           3: 0x55cc8962672c  [/home/builduser/project/src/out/Default/electron]
           4: 0x55cc8988a722 v8::internal::HandleScope::Extend(v8::internal::Isolate*) [/home/builduser/project/src/out/Default/electron]
           5: 0x55cc89622087  [/home/builduser/project/src/out/Default/electron]
           6: 0x55cc89689d93 v8::Integer::New(v8::Isolate*, int) [/home/builduser/project/src/out/Default/electron]
           7: 0x7f315137ed8b weakCallback(Nan::WeakCallbackInfo<int> const&) [/home/builduser/project/src/third_party/nan/test/build/Release/weak.node]
           8: 0x7f315137f829 void Nan::WeakCallbackInfo<int>::invokeparameter<false>(v8::WeakCallbackInfo<Nan::WeakCallbackInfo<int> > const&) [/home/builduser/project/src/third_party/nan/test/build/Release/weak.node]
           9: 0x55cc8988689e v8::internal::GlobalHandles::InvokeSecondPassPhantomCallbacksFromTask() [/home/builduser/project/src/out/Default/electron]
          10: 0x55cc90430344  [/home/builduser/project/src/out/Default/electron]
          11: 0x55cc9042f1e3  [/home/builduser/project/src/out/Default/electron]
          12: 0x55cc904c2464  [/home/builduser/project/src/out/Default/electron]
          13: 0x55cc904d1b68  [/home/builduser/project/src/out/Default/electron]
          14: 0x55cc904c28c1 uv_run [/home/builduser/project/src/out/Default/electron]
          15: 0x55cc88555202  [/home/builduser/project/src/out/Default/electron]
          16: 0x55cc883c75ca  [/home/builduser/project/src/out/Default/electron]
          17: 0x7f315ca4cb97 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
          18: 0x55cc883c736a _start [/home/builduser/project/src/out/Default/electron]
        command: "/home/builduser/project/src/out/Default/electron weak-test.js"

Per https://chromium-review.googlesource.com/c/v8/v8/+/2037442, it seems that the callback in SetWeak shouldn't be calling any V8 APIs. I think this test should be revised to use SetSecondPassCallback?

Hm... Actually, looking closer at that stack trace, I see it's in InvokeSecondPassPhantomCallbacksFromTask which indicates that it is, in fact, running in the 2nd pass. I guess something else must be going on. Sorry for the noise!