-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix: 🐛 fix stuck in http request #81
base: main
Are you sure you want to change the base?
Conversation
Also I have done a little test stream
.on('abort', console.log)
.on('connect', console.log)
.on('continue', console.log)
.on('information', console.log)
.on('response', console.log)
.on('socket', console.log)
.on('timeout', console.log)
.on('upgrade', console.log)
.on('close', console.log)
.on('drain', console.log)
.on('error', console.log)
.on('finish', console.log)
.on('pipe', console.log)
.on('unpipe', console.log) none of this were fired when network disconnected |
See #80 for updated results |
Fixes: Get rid of deprecated Node.js API: url.parse huan#20
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.
I'm thinking about we need an automation unit test for guarding this problem automatically.
@huan |
https://betterstack.com/community/guides/scaling-nodejs/nodejs-timeouts/
|
Ok, I don't think there is enough testing in various scenarios now, and there is no need to set the default value too small. |
The latest problem is that the unit test clock is not mocked successfully: It will take a long time to finish the test, instead of seconds. We have to figure out how to make the clock mock work before it can be merged. |
I've spent a day researching this problem, but didn't find a solution. Therefore, I changed the test to run concurrently to reduce the overall time taken by this test. |
I investigated the source code of nodejs and found that the problem should be that
https://github.com/nodejs/node/blob/v16.x/lib/_http_client.js#L926-L952 https://github.com/nodejs/node/blob/v16.x/lib/net.js#L533 https://github.com/nodejs/node/blob/v16.x/lib/net.js#L74-L85 https://github.com/nodejs/node/blob/v16.x/lib/net.js#L237-L265 https://github.com/nodejs/node/blob/v16.x/lib/internal/timers.js#L372-L380
https://github.com/nodejs/node/blob/v16.x/lib/timers.js#L140-L168 |
You do not have to keep convincing me that this is impossible, as I believe everything should be testable. Let me try to figure it out myself later. Thanks. |
Have you found any good solution? |
Fixes: #80