运行以下程序时,我遇到了由V8报告的致命错误:
var Fiber = require("fibers");
Fiber(function () {});
global.gc();
用于运行它的命令:
> node --expose-gc scratch.js
致命错误的文本如下:
#
# Fatal error in ..\..\src\global-handles.cc, line 99
# CHECK(state_ != FREE) failed
#
我正在使用以下版本:
vcbuild x86 Debug
构建)断言失败发生在
gc()
调用下方。这是GC回调中的调用堆栈,直接回叫到ASSt语句的fibers
: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++
该致命错误不会在 Node 的
Release
版本中出现。但是,它似乎巧妙地破坏了V8引擎,并且最终在随机代码中最终失败了一点。现在,我想出的唯一解决方法是泄漏光纤,以使这段代码永远不会被击中。我是在做某些特别错误的事情,还是
fibers
中的错误? 最佳答案
现在,此提交显然已修复了该错误:
https://github.com/laverdet/node-fibers/commit/3e154941ba5c3234752af304defcf028107e5557 src/fibers.cc@@ -231,7 +231,6 @@ class Fiber {return;}- that.handle.Dispose();delete &that;}