-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
benchmark: fix net/dgram.js infinite loop #486
Conversation
I saw this the other day too, but I'm not sure what impact |
I think there are two things going on here:
EDIT: Sorry, scratch that; I thought this benchmark was using the binding layer directly. |
if this bug is solved, all benchmark tests work fine. I would like to ask a question. this callback seems to be called synchronously, is this a right behavior? IMO, UDP does not check reaching the target, so the behavior looks fine. |
If that is what happens, then no, that would definitely be the wrong behavior. I don't think it's that, though. I did a quick check and it seems the callback is just never called. Will investigate. |
Okay, perhaps it does get called synchronously somehow. |
According to libuv CHANGELOG, I can find a commit " unix: try to write immediately in uv_udp_send libuv/libuv@4189122". @bnoordhuis I guess this is the reason why socket.send callback is called synchronously. How do I fix this script? setImmediate is OK? |
ping @bnoordhuis ? |
@@ -39,7 +39,7 @@ function server() { | |||
function onsend() { | |||
if (sent++ % num == 0) | |||
for (var i = 0; i < num; i++) | |||
socket.send(chunk, 0, chunk.length, PORT, '127.0.0.1', onsend); | |||
socket.send(chunk, 0, chunk.length, PORT, '127.0.0.1', setImmediate(onsend)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be like setImmediate.bind(null, onsend)
?
@yosuke-furukawa I appreciate the fix for the test, but if callbacks are really getting called synchronously now, that will have to be addressed. It violates the 'callbacks are always asynchronous' contract. |
Closing. This PR doesn't seem to fix anything |
benchmark script is not finished. net/dgram.js has infinite loop.