laverdet / node-fibers Goto Github PK
View Code? Open in Web Editor NEWFiber/coroutine support for v8 and node.
License: MIT License
Fiber/coroutine support for v8 and node.
License: MIT License
[email protected] - ok
[email protected] - broken pipe
installed from [email protected]
[email protected]
Linux dev2 2.6.18-194.3.1.el5.028stab069.6xen #1 SMP Wed May 26 18:35:38 MSD 2010 x86_64 x86_64 x86_64 GNU/Linux
npm ERR! TypeError: object is not a function
npm ERR! at Object.CALL_NON_FUNCTION (native)
npm ERR! at cb (/usr/lib/nodejs/rimraf.js:43:5)
npm ERR! at /usr/lib/nodejs/rimraf.js:62:20
npm ERR! at cb (/usr/lib/nodejs/graceful-fs.js:31:9)
npm ERR! Report this _entire_ log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]
npm ERR!
npm ERR! System Linux 3.1.0-0.rc3.git0.0.fc16.x86_64
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "[email protected]"
npm ERR! cwd /root
npm ERR! node -v v0.4.11
npm ERR! npm -v 1.0.26
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /root/npm-debug.log
npm not ok
[root@bradford ~]#
Hi,
In your fibers 0.2.0 nodejs google groups post, you show two code blocks:
function F1() {
var fiber = Fiber(function() {
yield();
});
fiber.run();
fiber.run();
}
function F2() {
var buf = new Buffer(5);
buf.write('hello');
var buf2 = new Buffer(5);
buf2.write('world');
}
And you make the claim "To put this in perspective, these two functions are about the same in terms
of cpu time spent. In fact F2() is slightly slower. "
I tried running 100,000 iterations of F1 & F2 myself. When I run the benchmarks on my OSX machine, I get these results:
F1: 1200ms
F2: 250ms
And on Ubuntu:
F1: 825ms
F2: 250ms
Did fibers get slower, did buffers get faster, or is there something wrong with my benchmarks? Assuming those numbers are correct, it looks like the JS to C++ interop is not the majority of the cost with fibers now.
I'm interested in the raw performance of creating & running new fibers, as it directly affects asyncblock. I understand that fibers can't be as fast as solutions built on pure node, but there might be some room for improvement.
Thanks for looking at this,
Chris
Hi,
I'm working through an issue with asyncblock, and I was wondering if you could help me figure something out. The basic case I want looks like this:
var asyncTask = function(callback) {
process.nextTick(function() {
callback();
});
};
var fiber = Fiber(function(){
process.nextTick(function(){
asyncTask(function() {
fiber.run();
});
var asyncTaskResult = Fiber.yield();
});
});
The problem I'm running into with the above example is that Fiber.yield doesn't work -- "yield() called with no fiber running". I tried storing Fiber.current in a variable, and manually setting Fiber.current before calling yield, but that doesn't seem to work either.
Edit: I posted earlier that the run call probably wouldn't work, but looking at it again I think it would as it maintains the reference to the fiber variable.
Thanks,
Chris
Hi,
Here is simplified code example (originally from [node-fiberize](from https://github.com/lm1/node-fiberize/)):
Fiber(function(){
var fiber = Fiber.current,
a = null;
var cb = function(value) {
a = value;
/* This is to handle the case where the callback is called
directly from wrapped function (not async), thus from same fiber.
It should have been done in resume actually, but in current
codebase there is no resume method added and native Fiber.run
is used (with no check Fiber.run would start a new fiber in this
case causing a disaster).
https://github.com/lm1/node-fiberize/commit/87391a31ab9a4823fa9130b576521e744ee15054#L0R51
*/
if (Fiber.current !== fiber) {
fiber.run();
}
}
setTimeout(function(){
cb(1);
}, 100)
while (!a) {
yield();
}
console.log(a);
}).run()
So, it's obviously prints the value of "a" when it will be assigned through callback:
1
But if I'll try to inherit another Fiber into:
Fiber(function(){
var fiber = Fiber.current,
a = null;
var cb = function(value) {
a = value;
if (Fiber.current !== fiber) {
fiber.run();
}
}
Fiber(function(){
cb(1);
}).run();
while (!a) {
yield();
}
console.log(a);
}).run()
I'll get the following output:
1
node(22145) malloc: *** error for object 0x100916890: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
/Users/octave/bin/fiber-shim: line 25: 22145 Abort trap FIBER_SHIM=1 DYLD_INSERT_LIBRARIES="$FIBERS_ROOT/coroutine.dylib" DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_LIBRARY_PATH="$FIBERS_ROOT" "$@"
node v0.3.8
node-fibers 0.1.3
OSX 10.6.3
I really want to use this library for my gaming application. When I build it, I seem to be getting an invalid directory in node.
g++ -fPIC -shared -Wl,-Bdynamic -Wall -Wno-deprecated-declarations -I/usr/include -I/usr/include/node -g -O3 -m64 -DCORO_UCONTEXT fibers.cc coroutine.o libcoro.o -o fibers.node -lpthread
fibers.cc:3:23: fatal error: node/node.h: No such file or directory <===========Invalid Directory?
compilation terminated.
make[1]: *** [fibers.node] Error 1
make[1]: Leaving directory `/home/louis/node-fibers/src'
make: *** [/home/louis/node-fibers/src/fibers.node] Error 2
If you have an idea of what it can be, your support would be really appreciated.
I am using node version v0.6.11, npm version 1.1.0-2 and ubuntu 12.04.
Thanks
Im trying to build fibers on my mac os x box (snow leopard). I got this error (tried both with npm and from source):
make -C src clean
rm -f fibers.node libcoro.o
rm -f -r .dSYM
rm -f -r man
make -C src
g++ -Wall -Wno-deprecated-declarations -I/include -I/include/node -g -O3 -minline-all-stringops -m64 -DCORO_SJLJ -o fibers.node fibers.cc /Users/jfd/checkouts/node-fibers/src/
In file included from fibers.cc:3:
/usr/local/include/node/node.h:41:16: error: uv.h: No such file or directory
/usr/local/include/node/node.h:42:17: error: eio.h: No such file or directory
/usr/local/include/node/node.h:43:16: error: v8.h: No such file or directory
/usr/local/include/node/node.h:47:30: error: node_object_wrap.h: No such file or directory
In file included from fibers.cc:3:
/usr/local/include/node/node.h:59: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:59: error: expected constructor, destructor, or type conversion before ‘<’ token
/usr/local/include/node/node.h:60: error: variable or field ‘Load’ declared void
/usr/local/include/node/node.h:60: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:60: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:60: error: ‘process’ was not declared in this scope
/usr/local/include/node/node.h:61: error: variable or field ‘EmitExit’ declared void
/usr/local/include/node/node.h:61: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:61: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:61: error: ‘process’ was not declared in this scope
/usr/local/include/node/node.h:89: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:89: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:89: error: ‘encoding_v’ was not declared in this scope
/usr/local/include/node/node.h:90: error: expected primary-expression before ‘enum’
/usr/local/include/node/node.h:90: error: initializer expression list treated as compound expression
/usr/local/include/node/node.h:91: error: variable or field ‘FatalException’ declared void
/usr/local/include/node/node.h:91: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:91: error: ‘try_catch’ was not declared in this scope
/usr/local/include/node/node.h:92: error: variable or field ‘DisplayExceptionLine’ declared void
/usr/local/include/node/node.h:92: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:92: error: ‘try_catch’ was not declared in this scope
/usr/local/include/node/node.h:94: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:94: error: expected constructor, destructor, or type conversion before ‘<’ token
/usr/local/include/node/node.h:98: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:98: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:98: error: expected primary-expression before ‘,’ token
/usr/local/include/node/node.h:99: error: expected primary-expression before ‘enum’
/usr/local/include/node/node.h:99: error: initializer expression list treated as compound expression
/usr/local/include/node/node.h:104: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:104: error: expected ‘,’ or ‘...’ before ‘<’ token
/usr/local/include/node/node.h:119: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:119: error: expected constructor, destructor, or type conversion before ‘<’ token
/usr/local/include/node/node.h:128: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:128: error: expected constructor, destructor, or type conversion before ‘<’ token
/usr/local/include/node/node.h:131: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:131: error: expected initializer before ‘<’ token
/usr/local/include/node/node.h:138: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:138: error: expected initializer before ‘<’ token
/usr/local/include/node/node.h:145: error: variable or field ‘cb_destroy’ declared void
/usr/local/include/node/node.h:145: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:145: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:145: error: ‘cb’ was not declared in this scope
/usr/local/include/node/node.h:150: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:150: error: expected constructor, destructor, or type conversion before ‘<’ token
/usr/local/include/node/node.h:161: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:161: error: expected ‘,’ or ‘...’ before ‘<’ token
/usr/local/include/node/node.h:191: error: variable or field ‘SetErrno’ declared void
/usr/local/include/node/node.h:191: error: ‘uv_err_code’ was not declared in this scope
/usr/local/include/node/node.h:192: error: variable or field ‘MakeCallback’ declared void
/usr/local/include/node/node.h:192: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:192: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:192: error: ‘object’ was not declared in this scope
/usr/local/include/node/node.h:193: error: expected primary-expression before ‘const’
/usr/local/include/node/node.h:194: error: expected primary-expression before ‘int’
/usr/local/include/node/node.h:195: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:195: error: ‘v8’ has not been declared
/usr/local/include/node/node.h:195: error: ‘argv’ was not declared in this scope
/usr/local/include/node/node.h:195: error: expected primary-expression before ‘]’ token
fibers.cc:18: error: ‘v8’ is not a namespace-name
fibers.cc:18: error: expected namespace-name before ‘;’ token
fibers.cc:27: error: ISO C++ forbids declaration of ‘Locker’ with no type
fibers.cc:27: error: expected ‘;’ before ‘’ token
fibers.cc:28: error: ISO C++ forbids declaration of ‘Persistent’ with no type
fibers.cc:28: error: expected ‘;’ before ‘<’ token
fibers.cc:29: error: ISO C++ forbids declaration of ‘Persistent’ with no type
fibers.cc:29: error: expected ‘;’ before ‘<’ token
fibers.cc:32: error: ISO C++ forbids declaration of ‘Persistent’ with no type
fibers.cc:32: error: expected ‘;’ before ‘<’ token
fibers.cc:33: error: ISO C++ forbids declaration of ‘Persistent’ with no type
fibers.cc:33: error: expected ‘;’ before ‘<’ token
fibers.cc:35: error: ISO C++ forbids declaration of ‘Persistent’ with no type
fibers.cc:35: error: expected ‘;’ before ‘<’ token
fibers.cc:36: error: ISO C++ forbids declaration of ‘Persistent’ with no type
fibers.cc:36: error: expected ‘;’ before ‘<’ token
fibers.cc:37: error: ISO C++ forbids declaration of ‘Persistent’ with no type
fibers.cc:37: error: expected ‘;’ before ‘<’ token
fibers.cc:38: error: ISO C++ forbids declaration of ‘Persistent’ with no type
fibers.cc:38: error: expected ‘;’ before ‘<’ token
fibers.cc:39: error: ISO C++ forbids declaration of ‘Persistent’ with no type
fibers.cc:39: error: expected ‘;’ before ‘<’ token
fibers.cc:48: error: expected )' before ‘<’ token fibers.cc:88: error: ‘Persistent’ has not been declared fibers.cc:88: error: expected ‘,’ or ‘...’ before ‘<’ token fibers.cc:148: error: ISO C++ forbids declaration of ‘Handle’ with no type fibers.cc:148: error: expected ‘;’ before ‘<’ token fibers.cc:508: error: expected
;' at end of input
fibers.cc:508: error: expected }' at end of input fibers.cc: In destructor ‘virtual Fiber::~Fiber()’: fibers.cc:62: error: ‘handle’ was not declared in this scope fibers.cc:63: error: ‘cb’ was not declared in this scope fibers.cc:64: error: ‘v8_context’ was not declared in this scope fibers.cc: In member function ‘void Fiber::MakeWeak()’: fibers.cc:72: error: ‘handle’ was not declared in this scope fibers.cc: In member function ‘void Fiber::ClearWeak()’: fibers.cc:80: error: ‘handle’ was not declared in this scope fibers.cc: In static member function ‘static void Fiber::WeakCallback(int)’: fibers.cc:89: error: ‘data’ was not declared in this scope fibers.cc:90: error: ‘class Fiber’ has no member named ‘handle’ fibers.cc:90: error: ‘value’ was not declared in this scope fibers.cc: In static member function ‘static void Fiber::DestroyOrphans()’: fibers.cc:123: error: ‘class Fiber’ has no member named ‘UnwindStack’ fibers.cc:128: error: ‘String’ has not been declared fibers.cc:128: error: expected
;' before ‘stack’
fibers.cc:133: error: ‘stack’ was not declared in this scope
fibers.cc:136: error: ‘fatal_stack’ was not declared in this scope
fibers.cc:139: error: ‘class Fiber’ has no member named ‘yielded’
fibers.cc: At global scope:
fibers.cc:142: error: expected unqualified-id at end of input
make[1]: *** [fibers.node] Error 1
make: *** [/Users/jfd/checkouts/node-fibers/src/] Error 2
This printed on the console, then the program exited with error code 134.
node: fibers.cc:440: static v8::Handlev8::Value Fiber::GetStarted(v8::Localv8::String, const v8::AccessorInfo&): Assertion `info.This()->InternalFieldCount() == 1' failed.
I was inspecting a variable with the debugger when it occurred.
Just thought I'd pass this along,
Chris
After 82f79ce I'm always getting the following error with node v0.3.6 (Linux debian 2.6.32-5-686). Works with 041247c.
node.js:68
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Fiber support was not enabled when you ran node. To enable support for fibers, please run node with the included `fiber-shim` script. For example, instead of running:
node script.js
You should run:
./fiber-shim node script.js
You will not be able to use Fiber without this support enabled.
In asyncAsSync
args[fn.length - 1] = cb;
When I call
var file = asyncAsSync(fs.readFile, 'file_name', 'utf-8');
I get buffer instead of string.
Replace to
args.push(cb)
solve problem
Hello!
I'm trying to adapt fibers for express/connect.
The arising problem seems very generic. Fiber.current disappears in the scenario described below.
I create session store RedisStore, it connects to the database. The data from db is handled by stream.on('data')
A request comes. It gets wrapped into Fiber
A request asks RedisStore for session. The store sends command to database. The database responds and stream.on('data') does not have Fiber.current any more.
So, the fiber gets lost, Fiber.current inside stream.on('data') is undefined. Probably because the connection was made outside of the fiber?
I believe, the same problem can arise for other databases.. Any way to fix it?
I get a segmentation fault when setting process.title:
$ cat test.js
require('fibers');
process.title = "test"
$ node-fibers test.js
/usr/local/bin/fiber-shim: line 24: 12635 Segmentation fault FIBER_SHIM=1 DYLD_INSERT_LIBRARIES="$FIBERS_ROOT/coroutine.dylib" DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_LIBRARY_PATH="$FIBERS_ROOT" "$@"
$ node-fibers sleep.js
node.js:63
throw e;
^
TypeError: Object function require(path) {
return loadModule(path, self);
} has no method 'resolve'
at Object.<anonymous> (/usr/local/lib/node/.npm/fibers/0.1.2/package/fibers.js:4:25)
at Module._compile (node.js:462:23)
at Module._loadScriptSync (node.js:469:10)
at Module.loadSync (node.js:338:12)
at loadModule (node.js:283:14)
at require (node.js:411:14)
at Object.<anonymous> (/usr/local/lib/node/fibers/index.js:8:18)
at Module._compile (node.js:462:23)
at Module._loadScriptSync (node.js:469:10)
at Module.loadSync (node.js:338:12)
After 'sieging' the fiber server for a while, I get a
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000200004d10
0x000000010008a866 in v8::internal::Deoptimizer::DoComputeOutputFrames ()
(gdb) bt
#0 0x000000010008a866 in v8::internal::Deoptimizer::DoComputeOutputFrames ()
#1 0x00000001051441d7 in ?? ()
#2 0x0000000100979578 in ?? ()
#3 0xd0148d4840408b48 in ?? ()
(gdb)
Source is here if you want to reproduce it: https://github.com/maccman/bullet - it usually takes a while of hitting the server.
I have an app, with doesn't use fibers.
Attempting to run it
"node-fibers debug app.js"
debug> run
node breaks at first line of app.
if app uses fibers, node dies.
Did anyone test "node-fibers debug" at all?
Hello,
I am trying to run my Node.js code with node-fibers, and I am getting the following error:
Could not find the coroutine shim!
I installed node-fibers using npm. My npm version is 0.2.19. My node.js version is 0.4.3. What should I do next?
Thank you,
Igor
It looks like Joyent's Smartmachines run SunOS 5.11.
node: v0.5.3
npm: 1.0.27
https://gist.github.com/1310414
Is there any chance of making this work, or is it a lost cause?
I installed 0.7.0 with the hopes of running some fibers benchmarks against V8 3.8.x, but the build fails on the first test.
37d9003 introduces the following assert:
node: fibers.cc:440: static v8::Handle<v8::Value> Fiber::GetStarted(v8::Local<v8::String>, const v8::AccessorInfo&): Assertion `info.Holder()->InternalFieldCount() == 1' failed.
Here goes a TC:
require('fibers');
var fs = require('fs');
Fiber(function() {
var f = Fiber.current;
fs.readFile(__filename, 'utf8', function(e) {
if (Fiber.current !== f && f.started) {
f.run();
}
});
yield();
}).run();
Hi!
Just wanted to raise a concern about using a potentially-keyword "yield" as it was introduced in Mozilla's JavaScript 1.7 with generators ( https://developer.mozilla.org/en/new_in_javascript_1.7 ).
It's not a part of any ECMAScript and most probably V8 would not support it in the nearest future, but if generators somehow sneak into V8 I think we're getting in trouble...
Since node-fibers is still quite new (and Mozilla guys kinda... have put dibs on "yield" :) ), why not rename global "yield" function into something potentially less conflicting?
Fibers and performance is of course a major issue. I wanted to test this, so I put together a small test-suite.
The test sends 100 000 messages between two fibers. Fiber 1 receives and Fiber 2 sends. I also put together a smilier test using nextTick. I know, you cannot put the two cases against each other , but I though it would be nice to have same kind of reference.
Fibers are currently 3-4 times slower that using nodes built-in event-loop.
I am somewhat satisfied with the result of fibers/master, but, the question remains, can fibers be even faster then they are today?
The test can be found here:
https://gist.github.com/922174
The results:
Using fibers(master)
[jfd@revh node-fibers(master)]$ time node-fibers fiber-perf-test.js
real 0m2.015s
user 0m1.470s
sys 0m0.537s
Using fibers(pthread)
[jfd@revh node-fibers(pthreads)]$ time node fiber-perf-test.js
real 0m4.572s
user 0m2.576s
sys 0m2.389s
process.nextTick (just for reference)
[jfd@revh node-fibers(master)]$ time node nexttick-perf-test.js
real 0m0.483s
user 0m0.367s
sys 0m0.111s:
This is packaging bug.
Installed with npm install fibers
and I get the message Could not find the coroutine shim!
whenever I run node-fibers. My ~/.npmrc
sets ~/bin
to be my default bin folder for node apps. ~/bin
is int $PATH. However fibers-shim
seems to be looking in here for fibers.node and coroutine.so which are not there but rather in ~/.node_libraries/.npm/fibers/0.2.0/package
.
For info I checked the value of dirname "$0"
which is used in fibers-shim and it yields /home/floby/bin
I'll be working on a patch if it is of any help.
For the testcase:
require('child_process').exec('echo A', function(err, stdout){
if (err) console.log('Error:', err);
else console.log('Output:', stdout);
});
I'm getting the following error with node-fibers loaded:
Error: { message: 'Command failed: /bin/sh: symbol lookup error: /home/lm/node-fibers/coroutine.so: undefined symbol: dlsym\n',
stack: [Getter/Setter],
killed: false,
code: 127,
signal: null }
The readme does not really give an overview, or tell clearly what it does. I would like to see something like
Node-fibers creates a thread-like feel, without losing the async efficiency expected of Node.JS. Instead of threads, we use Fibers. Fibers are created by (short description of how it works.)
How does it do this? Is there an API in Node that it uses? A capability found in V8? Complicated C-level interactions to accomplish this?
OS: Ubuntu 11.04 32bit
NodeJS: 0.5.4
$ npm install fibers
[email protected] install /home/faiwer/pro/www/faiwer/node_modules/fibers
make clean allmake -C src clean
make[1]: Вход в каталог/home/faiwer/pro/www/faiwer/node_modules/fibers/src' rm -f fibers.node libcoro.o rm -f -r *.dSYM make[1]: Выход из каталога
/home/faiwer/pro/www/faiwer/node_modules/fibers/src'
rm -f -r man
make -C src
make[1]: Вход в каталог/home/faiwer/pro/www/faiwer/node_modules/fibers/src' g++ -Wall -Wno-deprecated-declarations -I/include -I/include/node -g -O3 -minline-all-stringops -m32 fibers.cc /home/faiwer/pro/www/faiwer/node_modules/fibers/src/ -o fibers.node In file included from fibers.cc:3:0: /usr/local/include/node/node.h:41:16: fatal error: uv.h: Нет такого файла или каталога ( ~= Not file or directory found ) compilation terminated. make[1]: *** [fibers.node] Error 1 make[1]: Выход из каталога
/home/faiwer/pro/www/faiwer/node_modules/fibers/src'
make: *** [/home/faiwer/pro/www/faiwer/node_modules/fibers/src/] Error 2
npm ERR! error installing [email protected] Error: [email protected] install:make clean all
npm ERR! error installing [email protected]sh "-c" "make clean all"
failed with 2
npm ERR! error installing [email protected] at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing [email protected] at ChildProcess.emit (events.js:70:17)
npm ERR! error installing [email protected] at ChildProcess.onexit (child_process_legacy.js:246:12)
npm ERR! [email protected] install:make clean all
npm ERR!sh "-c" "make clean all"
failed with 2
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the fibers package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! make clean all
npm ERR! You can get their info via:
npm ERR! npm owner ls fibers
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 2.6.38-8-generic
npm ERR! command "node" "/usr/local/bin/npm" "install" "fibers"
npm ERR! cwd /home/faiwer/pro/www/faiwer
npm ERR! node -v v0.5.4
npm ERR! npm -v 1.0.25
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/faiwer/pro/www/faiwer/npm-debug.log
npm not ok
What I need doing for installing fibers on my pc?
P.S. sorry for my bad english
UPD 1:
$ ls /usr/local/include/node/
ares.h
ev.h
node_version.h
v8.h
ares_version.h
ngx-queue.h
tree.h
v8-preparser.h
c-ares
node_buffer.h
uv.h
v8-profiler.h
config.h
node_config.h
uv-unix.h
v8stdint.h
eio.h
node.h
uv-win.h
v8-testing.h
ev
node_object_wrap.h
v8-debug.h
I've noticed that creating & running fibers is slow when the debugger is attached.
I had a situation where I was debugging code that made over a thousand fibers, and it took about a minute to run just the fiber creation code.
I'm not sure if there's anything reasonable that can be done, or if you care about this, but I just thought I'd pass it along.
Thanks,
Chris
My npm version is 1.1.0-2 if it matters.
Here's the output:
npm install [email protected]
npm http GET https://registry.npmjs.org/fibers/0.6.5
npm http 304 https://registry.npmjs.org/fibers/0.6.5
[email protected] install /home/scriby/ftest/node_modules/fibers
make clean all
make -C src clean
make[1]: Entering directory /home/scriby/ftest/node_modules/fibers/src' rm -f fibers.node libcoro.o coroutine.o rm -f -r *.dSYM make[1]: Leaving directory
/home/scriby/ftest/node_modules/fibers/src'
rm -f -r man
make -C src fibers.node
make[1]: Entering directory /home/scriby/ftest/node_modules/fibers/src' g++ -Wall -Wno-deprecated-declarations -I/usr/local/include -I/usr/local/include/node -g -O3 -m64 -DCORO_UCONTEXT -fPIC -c -o coroutine.o coroutine.cc coroutine.cc:12:41: warning: converting to non-pointer type ‘pthread_key_t’ from NULL coroutine.cc:13:40: warning: converting to non-pointer type ‘pthread_key_t’ from NULL coroutine.cc: In constructor ‘Coroutine::Coroutine()’: coroutine.cc:66:46: warning: passing NULL to non-pointer argument 5 of ‘void coro_create(coro_context*, void (*)(void*), void*, void*, long int)’ coroutine.cc: In destructor ‘Coroutine::~Coroutine()’: coroutine.cc:77:24: warning: statement has no effect cc -Wall -Wno-deprecated-declarations -I/usr/local/include -I/usr/local/include/node -g -O3 -m64 -DCORO_UCONTEXT -fPIC -c -o libcoro.o libcoro/coro.c g++ -fPIC -shared -Wl,-Bdynamic -Wall -Wno-deprecated-declarations -I/usr/local/include -I/usr/local/include/node -g -O3 -m64 -DCORO_UCONTEXT fibers.cc coroutine.o libcoro.o -o fibers.node -lpthread make[1]: Leaving directory
/home/scriby/ftest/node_modules/fibers/src'
./test.sh
already-running.js: pass
./test.sh: 9: [[: not found
bad-context.js: pass
./test.sh: 9: [[: not found
child-process.js: pass
./test.sh: 9: [[: not found
current.js: pass
./test.sh: 9: [[: not found
exec.js: pass
./test.sh: 9: [[: not found
exit.js: pass
./test.sh: 9: [[: not found
fibonacci.js: pass
./test.sh: 9: [[: not found
finish-multiple.js: pass
./test.sh: 9: [[: not found
future.js: pass
./test.sh: 9: [[: not found
illegal-yield.js: pass
./test.sh: 9: [[: not found
pool.js: pass
./test.sh: 9: [[: not found
process-title.js: pass
./test.sh: 9: [[: not found
stack-overflow.js: pass
./test.sh: 9: [[: not found
started.js: pass
./test.sh: 9: [[: not found
unwind.js: pass
./test.sh: 9: [[: not found
[email protected] ./node_modules/fibers
Great library and improves maintainability of my app lot (which is a very important aspect in a larger application in IMHO).
However moving this module around is tricky due to the fact that fibers.node is linked to the fullpath of coroutine.so. For example the ldd output:
ldd fibers.node
linux-gate.so.1 => (0x00cee000)
/home/dks/src/node-fibers/src/coroutine.so (0x003a0000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0x00ed9000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0x009a5000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0x00110000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x00a9c000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0x00653000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0x00ebe000)
/lib/ld-linux.so.2 (0x00767000)
Would it be possible statically link coroutine.a so we could just move fibers.node around and don't have to worry about other files (or provide this as an option in the Makefile at least)?
I understand Windows support is not a priority, but is there a sense for what this would require? For instance, does libcoro work without cygwin?
I have a strong impression that the sanity check in fibers.js causes a hazard in node v0.3.6. It seems to be an issue in node, and it looks it's been fixed recently (nodejs/node-v0.x-archive@91cc2d8?) as it does not occur with latest node build. Although moving require('./src/fibers'); to the top of fibers.js resolves the problem, thus I would suggest moving it for safety.
I'm unable to provide a test case, because it is quite large... changes like adding prints or loading extra modules before starting a fiber change its behavior. But change in fibers.js resolves it in all cases. An error is something like this:
fibers-promise.js:45
fiber.run();
^
undefined
When I tried Fiber() I got this error:
node: fibers.cc:495: void init(v8::Handlev8::Object): Assertion `Coroutine::is_local_storage_enabled()' failed.
When attempting to compile from source, seems to be same error as issue #13 (Cannot compile under Linux x84_64 (OpenVZ)).
Using NPM version 1.0.15.
When attempting to install from NPM (sudo npm install -g fibers):
/usr/bin/node-fibers -> /usr/lib/node_modules/fibers/bin/node-fibers
[email protected] install /usr/lib/node_modules/fibers
make clean all
make -C src clean
make[1]: Entering directory /usr/lib/node_modules/fibers/src' rm -f fibers.node coroutine.so rm -f -r *.dSYM make[1]: Leaving directory
/usr/lib/node_modules/fibers/src'
rm -f -r man
make -C src coroutine.so
make[1]: Entering directory /usr/lib/node_modules/fibers/src' g++ -Wall -I/usr/local/include -I/usr/local/include/node -g -O3 -minline-all-stringops -m32 -fPIC -shared -o coroutine.so coroutine.cc -lpthread -ldl In file included from /usr/include/features.h:388:0, from /usr/include/stdlib.h:25, from coroutine.h:5, from coroutine.cc:1: /usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory compilation terminated. make[1]: *** [coroutine.so] Error 1 make[1]: Leaving directory
/usr/lib/node_modules/fibers/src'
make: *** [/usr/lib/node_modules/fibers/src/coroutine.so] Error 2
npm ERR! error installing [email protected] Error: [email protected] install: make clean all
npm ERR! error installing [email protected] sh "-c" "make clean all"
failed with 2
npm ERR! error installing [email protected] at ChildProcess. (/usr/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing [email protected] at ChildProcess.emit (events.js:67:17)
npm ERR! error installing [email protected] at ChildProcess.onexit (child_process.js:246:12)
npm ERR! [email protected] install: make clean all
npm ERR! sh "-c" "make clean all"
failed with 2
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the fibers package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! make clean all
npm ERR! You can get their info via:
npm ERR! npm owner ls fibers
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 2.6.38-8-generic
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "fibers"
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /var/www/lib/node-fibers/npm-debug.log
npm not ok
A while back I had this problem and I was given a workaround for my system that worked and I enjoyed playing with it. Before I actually started using it in production code I upgraded node and it broke again.
Now I am on a server that I just brought up from scratch. The latest stable node and stable npm are on it. I haven't mucked with the installation at all. I did npm install fibers -g. Now when I do node-fibers xxx i get the dreaded message again.
Surely there is some problem in the fibers script. I would be happy to act as a human proxy to debug this. I really want to use fibers.
I'm running ubuntu lucid.
# make
make -C src coroutine.so
make[1]: Entering directory `/home/octave/src/node/node-fibers/src'
g++ -Wall -I/usr/local/include -I/usr/local/include/node -g -O3 -minline-all-stringops -m64 -fPIC -shared -o coroutine.so coroutine.cc -lpthread -ldl
coroutine.cc:49: warning: converting to non-pointer type 'pthread_key_t' from NULL
coroutine.cc: In constructor 'Thread::Thread()':
coroutine.cc:77: warning: converting to non-pointer type 'pthread_t' from NULL
coroutine.cc: In function 'int pthread_equal(pthread_t, pthread_t)':
coroutine.cc:386: error: redefinition of 'int pthread_equal(pthread_t, pthread_t)'
/usr/include/pthread.h:1110: error: 'int pthread_equal(pthread_t, pthread_t)' previously defined here
make[1]: *** [coroutine.so] Error 1
make[1]: Leaving directory `/home/octave/src/node/node-fibers/src'
make: *** [/home/octave/src/node/node-fibers/src/coroutine.so] Error 2
os (under OpenVZ)
# uname -a
Linux dev3.lan 2.6.18-194.26.1.el5.028stab079.2 1 SMP Fri Dec 17 19:25:15 MSK 2010 x86_64 x86_64 x86_64 GNU/Linux
This is not what one should do, but maybe we can do better then segfault:
require('fibers');
yield();
local/bin/fiber-shim: line 24: 29853 Segmentation fault FIBER_SHIM=1 LD_PRELOAD="$FIBERS_ROOT/coroutine.so" "$@"
Right now a significant part of the runtime cost of fibers is entering the v8 C++ API; switching between JS and C++ is fairly expensive. The way node-fibers is built, creating a fiber enters C++ which is not necessary. We could restructure the code so that you don't enter C++ until the first time run() is called. Since it seems most uses of fibers create a fiber, immediately run them, and then destroy them, this should be a net gain. Unfortunately it may require rewriting a large portions of fibers in JS.
I'm trying to run node-fibers on Darwin 11.0.0 (Lion), and each time it just returns "Segmentation fault 11". I installed via npm install -g fibers, and that's all successful. And node can resolve the fibers module just fine... it just refuses to run properly. Any ideas?
I'm trying to build and use fibers on a BeagleBone board with node 0.6.x. I know it works on node 0.4.12 because the board ships with that version of node and with fibers installed.
The first problem I ran into is that platform.mk was passing the unsupported "-minline-all-stringops" flag. It was also passing "-m32" rather than the required "-marm".
Once I removed the former and adjusted the latter, the compile worked. However, when I try to run a simple script I get a segmentation fault.
# file `which node`
/usr/local/bin/node: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
Here's the output from the successful make:
fibers/src# make
g++ -march=armv7-a -mno-thumb-interwork -fno-tree-sink -Wno-psabi -Wall -Wno-deprecated-declarations -I/usr/local/include -I/usr/local/include/node -g -O3 -marm -DCORO_UCONTEXT -fPIC -c -o coroutine.o coroutine.cc
coroutine.cc:14:41: warning: converting to non-pointer type 'pthread_key_t' from NULL
coroutine.cc:15:40: warning: converting to non-pointer type 'pthread_key_t' from NULL
coroutine.cc: In constructor 'Coroutine::Coroutine()':
coroutine.cc:62:46: warning: passing NULL to non-pointer argument 5 of 'void coro_create(coro_context*, void (*)(void*), void*, void*, long int)'
coroutine.cc: In destructor 'Coroutine::~Coroutine()':
coroutine.cc:73:24: warning: statement has no effect
cc -march=armv7-a -mno-thumb-interwork -fno-tree-sink -Wno-psabi -Wall -Wno-deprecated-declarations -I/usr/local/include -I/usr/local/include/node -g -O3 -marm -DCORO_UCONTEXT -fPIC -c -o libcoro.o libcoro/coro.c
g++ -fPIC -shared -Wl,-Bdynamic -Wall -Wno-deprecated-declarations -I/usr/local/include -I/usr/local/include/node -g -O3 -marm -DCORO_UCONTEXT fibers.cc coroutine.o libcoro.o -o fibers.node -lpthread
Any help you can provide would be very much appreciated.
Any idea what's going wrong here? Sleep isn't running asynchronously:
https://gist.github.com/486e61712ad43278409f
Thanks,
Alex MacCaw
I have 2 issues with your sleep function.
btw, I was able to pretty easily implement a generic sharable sleep function in fibers-promise, which I'm using more than this project.
Hi,
I'm trying to implement an asynchronous generator with one fiber. I think it might not be possible, though.
Is there any way to get control back to A in the above scenario?
Thanks,
Chris
(relates to issue #29)
After getting the necessary libraries to compile fibers for my 64-bit Ubuntu install, the compiled version throws some "ELFCLASS32" errors. Fibers compiled with the '-m32' flag and so I went a-digging.
The NODE_BITS flag in platform.mk uses a regexp to determine if your system is x64. My system does not express its bit-ness in a format the NODE_BITS regexp would recognize. It follows:
Welcome to Ubuntu 11.04 (GNU/Linux 2.6.38-8-generic x86_64)
I hacked on the Makefile to fix this issue, and subsequently I am able to start the node-fibers command without issue. I haven't tested it extensively, but it launches from terminal and passes some basic hello world tests. I am getting a seg fault when I require('sync') but that's another ticket on another repo :)
Anyway, just thought I'd share this so you could update platform.mk to detect a wider audience of 64-bit users.
Hi,
Have the following error when trying to launch node-cluster via node-fibers:
web/cluster.js:
var cluster = require('cluster')
, http = require('http');
var server = http.createServer(function(req, res){
res.writeHead(200);
res.end('Hello World');
});
cluster(server).listen(3000);
running:
$ node-fibers web/cluster
Assertion failed: (Coroutine::is_local_storage_enabled()), function init, file fibers.cc, line 504.
OSX 10.6.3
Node v0.4.2
Fibers v0.2.3
Cluster v0.5.3
Code from your examples
require('fibers');
function sleep(ms) {
var fiber = Fiber.current;
setTimeout(function() {
fiber.run();
}, ms);
yield();
}
Fiber(function() {
console.log('wait... ' + new Date);
sleep(1000);
console.log('ok... ' + new Date);
}).run();
console.log('back in main');
And error (Node 0.4.11, NPM 1.0.27, Ubuntu 64bit)
*** longjmp causes uninitialized stack frame ***: /usr/local/bin/node terminated
======= Backtrace: =========
/lib/libc.so.6(fortify_fail+0x37)[0x7ff93459f217]
/lib/libc.so.6(+0xff1a9)[0x7ff93459f1a9]
/lib/libc.so.6(longjmpchk+0x33)[0x7ff93459f113]
/usr/local/lib/node_modules/sync/node_modules/fibers/bin/../src/coroutine.so(coro_create+0x202)[0x7ff935de3c92]
/usr/local/lib/node_modules/sync/node_modules/fibers/bin/../src/coroutine.so(_ZN9CoroutineC1ER6ThreadRFvPvES2+0xbe)[0x7ff935de2b3e]
/usr/local/lib/nodemodules/sync/node_modules/fibers/bin/../src/coroutine.so(_ZN9Coroutine12create_fiberEPFvPvES0+0xa1)[0x7ff935de2c81]
/usr/local/lib/node_modules/sync/node_modules/fibers/src/fibers.node(_ZN5Fiber3RunERKN2v89ArgumentsE+0x61e)[0x7ff90ff3b39e]
/usr/local/bin/node[0x581254]
[0x7ff91028a24a]
======= Memory map: ========
00400000-009e6000 r-xp 00000000 ca:01 129977 /usr/local/bin/node
00be6000-00be7000 r--p 005e6000 ca:01 129977 /usr/local/bin/node
00be7000-00bf0000 rw-p 005e7000 ca:01 129977 /usr/local/bin/node
00bf0000-00cf9000 rw-p 00000000 00:00 0 [heap]
7ff90ff37000-7ff90ff3d000 r-xp 00000000 ca:01 268573 /usr/local/lib/node_modules/sync/node_modules/fibers/src/fibers.node
7ff90ff3d000-7ff91013c000 ---p 00006000 ca:01 268573 /usr/local/lib/node_modules/sync/node_modules/fibers/src/fibers.node
7ff91013c000-7ff91013d000 r--p 00005000 ca:01 268573 /usr/local/lib/node_modules/sync/node_modules/fibers/src/fibers.node
7ff91013d000-7ff91013e000 rw-p 00006000 ca:01 268573 /usr/local/lib/node_modules/sync/node_modules/fibers/src/fibers.node
7ff91013e000-7ff910289000 rw-p 00000000 00:00 0
7ff910289000-7ff910363000 rwxp 00000000 00:00 0
7ff910363000-7ff932000000 ---p 00000000 00:00 0
7ff932000000-7ff932100000 rw-p 00000000 00:00 0
7ff932100000-7ff933000000 ---p 00000000 00:00 0
7ff933000000-7ff933100000 rw-p 00000000 00:00 0
7ff933100000-7ff934289000 ---p 00000000 00:00 0
7ff934289000-7ff93429f000 r-xp 00000000 ca:01 389828 /lib/libz.so.1.2.3.3
7ff93429f000-7ff93449e000 ---p 00016000 ca:01 389828 /lib/libz.so.1.2.3.3
7ff93449e000-7ff93449f000 r--p 00015000 ca:01 389828 /lib/libz.so.1.2.3.3
7ff93449f000-7ff9344a0000 rw-p 00016000 ca:01 389828 /lib/libz.so.1.2.3.3
7ff9344a0000-7ff93461a000 r-xp 00000000 ca:01 389517 /lib/libc-2.11.1.so
7ff93461a000-7ff934819000 ---p 0017a000 ca:01 389517 /lib/libc-2.11.1.so
7ff934819000-7ff93481d000 r--p 00179000 ca:01 389517 /lib/libc-2.11.1.so
7ff93481d000-7ff93481e000 rw-p 0017d000 ca:01 389517 /lib/libc-2.11.1.so
7ff93481e000-7ff934823000 rw-p 00000000 00:00 0
7ff934823000-7ff93483b000 r-xp 00000000 ca:01 390043 /lib/libpthread-2.11.1.so
7ff93483b000-7ff934a3a000 ---p 00018000 ca:01 390043 /lib/libpthread-2.11.1.so
7ff934a3a000-7ff934a3b000 r--p 00017000 ca:01 390043 /lib/libpthread-2.11.1.so
7ff934a3b000-7ff934a3c000 rw-p 00018000 ca:01 390043 /lib/libpthread-2.11.1.so
7ff934a3c000-7ff934a40000 rw-p 00000000 00:00 0
7ff934a40000-7ff934a56000 r-xp 00000000 ca:01 389560 /lib/libgcc_s.so.1
7ff934a56000-7ff934c55000 ---p 00016000 ca:01 389560 /lib/libgcc_s.so.1
7ff934c55000-7ff934c56000 r--p 00015000 ca:01 389560 /lib/libgcc_s.so.1
7ff934c56000-7ff934c57000 rw-p 00016000 ca:01 389560 /lib/libgcc_s.so.1
7ff934c57000-7ff934cd9000 r-xp 00000000 ca:01 389799 /lib/libm-2.11.1.so
7ff934cd9000-7ff934ed8000 ---p 00082000 ca:01 389799 /lib/libm-2.11.1.so
7ff934ed8000-7ff934ed9000 r--p 00081000 ca:01 389799 /lib/libm-2.11.1.so
7ff934ed9000-7ff934eda000 rw-p 00082000 ca:01 389799 /lib/libm-2.11.1.so
7ff934eda000-7ff934fd0000 r-xp 00000000 ca:01 131812 /usr/lib/libstdc++.so.6.0.13
7ff934fd0000-7ff9351d0000 ---p 000f6000 ca:01 131812 /usr/lib/libstdc++.so.6.0.13
7ff9351d0000-7ff9351d7000 r--p 000f6000 ca:01 131812 /usr/lib/libstdc++.so.6.0.13
7ff9351d7000-7ff9351d9000 rw-p 000fd000 ca:01 131812 /usr/lib/libstdc++.so.6.0.13
7ff9351d9000-7ff9351ee000 rw-p 00000000 00:00 0
7ff9351ee000-7ff9351f0000 r-xp 00000000 ca:01 390048 /lib/libutil-2.11.1.so
7ff9351f0000-7ff9353ef000 ---p 00002000 ca:01 390048 /lib/libutil-2.11.1.so
7ff9353ef000-7ff9353f0000 r--p 00001000 ca:01 390048 /lib/libutil-2.11.1.so
7ff9353f0000-7ff9353f1000 rw-p 00002000 ca:01 390048 /lib/libutil-2.11.1.so
7ff9353f1000-7ff9353f3000 r-xp 00000000 ca:01 389797 /lib/libdl-2.11.1.so
7ff9353f3000-7ff9355f3000 ---p 00002000 ca:01 389797 /lib/libdl-2.11.1.so
7ff9355f3000-7ff9355f4000 r--p 00002000 ca:01 389797 /lib/libdl-2.11.1.so
7ff9355f4000-7ff9355f5000 rw-p 00003000 ca:01 389797 /lib/libdl-2.11.1.so
7ff9355f5000-7ff93575d000 r-xp 00000000 ca:01 389547 /lib/libcrypto.so.0.9.8
7ff93575d000-7ff93595c000 ---p 00168000 ca:01 389547 /lib/libcrypto.so.0.9.8
7ff93595c000-7ff935969000 r--p 00167000 ca:01 389547 /lib/libcrypto.so.0.9.8
7ff935969000-7ff935981000 rw-p 00174000 ca:01 389547 /lib/libcrypto.so.0.9.8
7ff935981000-7ff935985000 rw-p 00000000 00:00 0
7ff935985000-7ff9359d0000 r-xp 00000000 ca:01 389610 /lib/libssl.so.0.9.8
7ff9359d0000-7ff935bcf000 ---p 0004b000 ca:01 389610 /lib/libssl.so.0.9.8
7ff935bcf000-7ff935bd1000 r--p 0004a000 ca:01 389610 /lib/libssl.so.0.9.8
7ff935bd1000-7ff935bd6000 rw-p 0004c000 ca:01 389610 /lib/libssl.so.0.9.8
7ff935bd6000-7ff935bd7000 rw-p 00000000 00:00 0
7ff935bd7000-7ff935bde000 r-xp 00000000 ca:01 390045 /lib/librt-2.11.1.so
It would be useful not only to pass something from fiber with yield(), but also to pass something back into fuber with run() like in ruby.
require("fibers")
function f(arg) {
console.log(arg)
console.log(yield())
}
var fiber = Fiber(f)
fiber.run("this is passed as an argument to f")
fiber.run("this is what yield() will return")
After node upgrade one needs to rebuild fibers, otherwise heap corruption occurs. Unfortunately 'npm rebuild fibers' doesn't work because there is no explicit dependency on node headers and make says it's up to date (probably rebuilding everything would be a better choice).
It would be best if fibers verified node binary build/timestamp and suggested rebuild of fibers upon node upgrade. Otherwise lot's of issues will get opened...
Hi,
That's nice:
try {
Fiber(function(){
throw new Error('test');
}).run();
}
catch (e) {
console.log('catched:', e.stack);
}
-->
catched: test
But
try {
Fiber(function(){
var fiber = Fiber.current;
process.nextTick(function(){
fiber.run();
})
yield();
throw new Error('test');
}).run();
}
catch (e) {
console.log('catched:', e.stack);
}
-->
node.js:116
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: test
at test/fibers.js:30:19
So, after yielding fiber does not throw an exception correctly.
Hi,
A funny issue cropped up today. Someone had a node.js program set up that required asyncblock normally, and then had a place in code that required it with camel case (asyncBlock). It was on a mac, so the 2nd require worked, but it crashed the app because of a fibers error:
Assertion failed: (!stack_size), function set_stack_size, file coroutine.cc, line 45.
Looking through the fibers code, it looks like set_stack_size isn't happy when it gets called twice. It looks like init was getting called again from the asyncBlock require.
You can reproduce this issue with just fibers by the following on a mac / case insensitive file system:
require('fibers');
require('FIBERS');
got the following error (process exit) when tried to benchmark my app that uses fibers with concurrency 100
$ ab -n 1000 -c 100 http://localhost:3000/events
Assertion failed: (delete_me == NULL), function fiber_did_finish, file coroutine.cc, line 112.
/Users/octave/bin/node-fibers: line 34: 1673 Abort trap FIBER_SHIM=1 DYLD_INSERT_LIBRARIES="$FIBERS_ROOT/coroutine.dylib" DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_LIBRARY_PATH="$FIBERS_ROOT"
Do you know what's the problem?
root@host:~/Downloads/.../62c5b4ac3db94d0# npm install fibers
[email protected] install /root/Downloads/.../62c5b4ac3db94d0/node_modules/fibers
make clean all
make -C src clean
make[1]: Entering directory /root/Downloads/.../62c5b4ac3db94d0/node_modules/fibers/src' rm -f fibers.node libcoro.o coroutine.o rm -f -r *.dSYM make[1]: Leaving directory
/root/Downloads/.../62c5b4ac3db94d0/node_modules/fibers/src'
rm -f -r man
make -C src fibers.node
make[1]: Entering directory /root/Downloads/.../62c5b4ac3db94d0/node_modules/fibers/src' g++ -Wall -Wno-deprecated-declarations -I/root/local/include -I/root/local/include/node -g -O3 -minline-all-stringops -m64 -DCORO_UCONTEXT -fPIC -c -o coroutine.o coroutine.cc coroutine.cc: In destructor ‘Coroutine::~Coroutine()’: coroutine.cc:73: warning: statement has no effect cc -Wall -Wno-deprecated-declarations -I/root/local/include -I/root/local/include/node -g -O3 -minline-all-stringops -m64 -DCORO_UCONTEXT -fPIC -c -o libcoro.o libcoro/coro.c g++ -fPIC -shared -Wl,-Bdynamic -Wall -Wno-deprecated-declarations -I/root/local/include -I/root/local/include/node -g -O3 -minline-all-stringops -m64 -DCORO_UCONTEXT fibers.cc coroutine.o libcoro.o -o fibers.node -lpthread make[1]: Leaving directory
/root/Downloads/.../work/62c5b4ac3db94d0/node_modules/fibers/src'
./test.sh
already-running.js: make: *** [test] Error 127
npm ERR! error installing [email protected] Error: [email protected] install: make clean all
npm ERR! error installing [email protected] sh "-c" "make clean all"
failed with 2
npm ERR! error installing [email protected] at ChildProcess. (/root/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing [email protected] at ChildProcess.emit (events.js:70:17)
npm ERR! error installing [email protected] at maybeExit (child_process.js:359:16)
npm ERR! error installing [email protected] at Process.onexit (child_process.js:395:5)
npm ERR! [email protected] install: make clean all
npm ERR! sh "-c" "make clean all"
failed with 2
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the fibers package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! make clean all
npm ERR! You can get their info via:
npm ERR! npm owner ls fibers
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 2.6.36-rc8101910
npm ERR! command "node" "/root/local/bin/npm" "install" "fibers"
npm ERR! cwd /root/Downloads/.../62c5b4ac3db94d0
npm ERR! node -v v0.6.3
npm ERR! npm -v 1.0.106
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /root/Downloads/TeamCity/buildAgent/work/62c5b4ac3db94d0/npm-debug.log
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.