I'm running into a fatal error reported by V8 when running the following program:
var Fiber = require("fibers");
Fiber(function () {});
global.gc();
The command used to run it:
> node --expose-gc scratch.js
The text of the fatal error is as follows:
#
# Fatal error in ..\..\src\global-handles.cc, line 99
# CHECK(state_ != FREE) failed
#
I'm using the following versions:
- node 0.10.25 x86 (built with
vcbuild x86 Debug
using VC2013) - node-fibers 1.0.1 taken from the GitHub repo (not npmjs)
The assertion failure happens below the gc()
call. Here's a call stack from the GC callback calling back into fibers
right down to the ASSERT statement:
node.exe!v8::internal::GlobalHandles::Node::Release(v8::internal::GlobalHandles * global_handles) Line 99 C++
node.exe!v8::internal::GlobalHandles::Destroy(v8::internal::Object * * location) Line 431 C++
node.exe!v8::V8::DisposeGlobal(v8::internal::Object * * obj) Line 680 C++
node.exe!v8::Persistent<v8::Object>::Dispose() Line 4241 C++
fibers.node!Fiber::`scalar deleting destructor'(unsigned int) C++
fibers.node!Fiber::WeakCallback(void * data) Line 235 C++
fibers.node!uni::WeakCallbackShim<&Fiber::WeakCallback>(v8::Persistent<v8::Value> value, void * data) Line 111 C++
node.exe!v8::internal::GlobalHandles::Node::PostGarbageCollectionProcessing(v8::internal::Isolate * isolate, v8::internal::GlobalHandles * global_handles) Line 233 C++
This fatal error doesn't come up in the Release
version of node. However, it appears to subtly corrupt the V8 engine and it ultimately fails a little bit down the line in a random piece of code.
Right now, the only workaround I've come up with is to leak fibers so that this piece of code is never hit. Am I doing something particularly wrong or is this a bug in fibers
?
The bug is now apparently fixed by this commit:
https://github.com/laverdet/node-fibers/commit/3e154941ba5c3234752af304defcf028107e5557
src/fibers.cc @@ -231,7 +231,6 @@ class Fiber { return; } - that.handle.Dispose(); delete &that; }