You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
Asynchronous callbacks are not called on REPL #9310
I can't reproduce your problem. If you're referring to the undefined that is initially printed, that is the value returned by fs.readFile(). The results are then printed asynchronously. You also have an extra , undefined in your first code sample.
'called' is not displayed until I press the space key.
And first fs.readFile displays the result immediately, but second one does not display until I press space keys.
From my test, it does not have any problem on Ubuntu.
Only MacOSX has this phenomenon.
Yep.. ok thank you @cjihrig. Seeing it now. Quite inconsistent... just did a longer test and for every three to five successful runs I'm seeing one failure. I previously just hadn't iterated the test enough times.
I'm seeing this problem as well after I upgraded from Node v0.10.x to v0.12.1 (and yes, I'm using OS X).
The command-line version of my x86 emulator starts a REPL to interact with the emulator's debugger. When I issue a "g" (go) command, the emulator -- which simulates a fixed processor speed (eg, 4.77Mhz) using setTimeout() -- runs very slowly and unevenly. Pressing keys at the REPL prompt triggers bursts of activity.
It's pretty clear that the setTimeout() callbacks are not being called consistently. This was not a problem in Node v0.10.x.
Before issuing the "g" (go) command, I first turned all emulator messages ("m all on"), which should produce a steady stream of messages once the emulator is running.
Instead, all I see is one message, and then I press "r", and another message appears, and so on.
Activity
cjihrig commentedon Mar 1, 2015
I can't reproduce your problem. If you're referring to the
undefinedthat is initially printed, that is the value returned byfs.readFile(). The results are then printed asynchronously. You also have an extra, undefinedin your first code sample.sixmen commentedon Mar 2, 2015
I was lack of detail explanation.
undefined is just to eliminate the return value of the setTimeout.
Please see this video.
Bug video
'called' is not displayed until I press the space key.
And first fs.readFile displays the result immediately, but second one does not display until I press space keys.
From my test, it does not have any problem on Ubuntu.
Only MacOSX has this phenomenon.
sixmen commentedon Mar 2, 2015
I examined deeper.
It occurs from v0.11.12, exactly from https://github.com/joyent/node/commits/e92d35d80be6e193cb547e94c6fbf3654542dbaa (uv: Upgrade to v0.11.22)
sixmen commentedon Mar 2, 2015
It seems the bug is created by libuv/libuv@b197515 .
jasnell commentedon Mar 3, 2015
Unable to recreate the problem on Mac OSX 10.10 running v0.12.0. Output:
'called' is printed after 5 seconds as expected.
cjihrig commentedon Mar 3, 2015
@jasnell I was able to recreate the
readFile()issue on OS X with 0.12. It's inconsistent, but does happen.jasnell commentedon Mar 3, 2015
Yep.. ok thank you @cjihrig. Seeing it now. Quite inconsistent... just did a longer test and for every three to five successful runs I'm seeing one failure. I previously just hadn't iterated the test enough times.
jeffpar commentedon Apr 3, 2015
I'm seeing this problem as well after I upgraded from Node v0.10.x to v0.12.1 (and yes, I'm using OS X).
The command-line version of my x86 emulator starts a REPL to interact with the emulator's debugger. When I issue a "g" (go) command, the emulator -- which simulates a fixed processor speed (eg, 4.77Mhz) using setTimeout() -- runs very slowly and unevenly. Pressing keys at the REPL prompt triggers bursts of activity.
It's pretty clear that the setTimeout() callbacks are not being called consistently. This was not a problem in Node v0.10.x.
jasnell commentedon Apr 3, 2015
@jeffpar can you test on v0.12.2 and see if you're still seeing the issue?
jeffpar commentedon Apr 3, 2015
Yes, still seeing the problem in 0.12.2. Sample output:
Before issuing the "g" (go) command, I first turned all emulator messages ("m all on"), which should produce a steady stream of messages once the emulator is running.
Instead, all I see is one message, and then I press "r", and another message appears, and so on.
sixmen commentedon Apr 6, 2015
This code shows the problem more clearly.
deps: update libuv to version 1.6.0
deps: update libuv to version 1.6.0
misterdjules commentedon Jun 9, 2015
Fixed by #25475.
deps: update libuv to version 1.6.1
misterdjules commentedon Jun 16, 2015
Fixed by 50f9615 and 097607c, closing. Thank you @sixmen 👍
These fixes will be available in the next v0.12.5 version of node.