-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
test: do not race server.close with timeout #44039
Conversation
|
This connection appears to be an idle connection to |
Ok it makes sense. It looks like |
@@ -9,6 +9,6 @@ server.listen(common.mustCall(() => { | |||
http.get({ port: server.address().port }, common.mustCall((res) => { | |||
res.on('timeout', common.mustCall(() => req.destroy())); |
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.
res.on('timeout', common.mustCall(() => req.destroy())); | |
res.on('timeout', common.mustCall(() => { | |
req.destroy(); | |
server.close(); | |
})); |
The original issue was that the listener of the 'timeout'
event was not called if added on the response
object so this should be ok. It does not invalidate the test and only one timer is used.
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.
Failure will require a timeout and kill from the runner in this case?
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.
Failure will require a timeout and kill from the runner in this case?
Yes.
@@ -9,6 +9,6 @@ server.listen(common.mustCall(() => { | |||
http.get({ port: server.address().port }, common.mustCall((res) => { | |||
res.on('timeout', common.mustCall(() => req.destroy())); | |||
res.setTimeout(1); | |||
server.close(); | |||
setTimeout(common.mustCall(() => server.close()), 2); |
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.
setTimeout(common.mustCall(() => server.close()), 2); |
Anyway I also think that |
About that test, I see timeouts too narrow. I wonder if events get scheduled in the wrong way in the same tick. |
FWIW no failures have been registered for this test in last 5 days, so I guess #43890 fixed the underlying issue. I think it is better to keep the test as is if it no longer fails. |
@lpinca, there is also libuv/libuv#3686 which is the real reason I am fixing this |
@lpinca @ShogunPanda |
Refs: #43680
This fails when
server.close()
manages to close the connection before the timeout has fired.Here is the original issue: #33734
It is not about the behaviour when racing
server.close()
with the timeout - it is about the timeout not firing at all. I am removing the race condition as I don't think there should be any guarantees on which callback should fire first.