-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
https request ends OK but app crash due to ECONNRESET after 10 minutes #14102
Comments
Did you try adding an |
I may be experiencing this same bug downstream in the |
@mscdex I did try res.on('error'), not working. |
@mscdex this issue might need enchancement in code or API document modification to show the correct behaviors when using https.request. So I would suggest remove the 'question' label to draw more attention, thanks. |
Some people (1, 2) have suggested this sort of thing: req.on('socket', function(socket) {
socket.on('error', function (error) {
reject(error);
req.abort();
});
}); And |
@nodejs/http |
@nodejs/http PTAL |
@nodejs/http Any updates on this? |
A full stack trace with the latest v8.x or v6.x would be helpful. I.e., without the |
I believe I am seeing this same problem in node v8.9.4. I am using http.createServer and the ws module and passing the http server instance to
I have added error handlers everywhere I can think of:
Two of the error handlers receive the
However I still get an uncaught exception:
That appears to be the entirety of the available stack trace. Since the emitted errors are exactly the same as the error from the uncaught exception it seems reasonable to assume that a bug is causing I can reliably reproduce the problem by connecting to the websocket server with chromium (firefox doesn' trigger this) and repeatedly hitting reload to cause rapid client connects and disconnects. This issue is sporadic but usually shows up after less than 10 reconnects. |
@Juul Can you reproduce without ws? I.e., using just built-in modules? |
@Juul it looks like you didn't add an error listener on the ws.on('connection', function (socket) {
socket.on('error', handleError);
}); From the above snippet you are only adding a listener on the |
@lpinca Yay! Thanks for the suggestion! This turned out to be the problem + a similar problem at an even higher layer. This is not a node.js issue. My apologies for taking up people's time. |
Dose anyone have a solution or work around on this issue? Have the logic below, seems ECONNRESET request(options, function(error, response) {
if (error) {
console.log('Caught');
}
}); |
@jwlbjtu Have you tried to add an 'error' event handler to the request? This is tested in the code base. |
Also, if anyone bumps into this and is sure that they have tried attaching an error handler to If you can only provide the client code to reproduce this, please try running the client with the environment variable
|
Issue has been resolved - by adding an error handler to the right object upon which the event was emitted. Closing. |
I had this Error too and was able to solve it after days of debugging and analysis: my solutionFor me VirtualBox (for Docker) was the Problem. I had Port Forwarding configured on my VM and the error only occured on the forwarded port. general conclusionsThe following observations may save you days of work I had to invest:
-> figure out if something is messing around with your network (-settings), like VMs, Firewalls etc., this is probably the cause of the problem. |
Trying to lock down the error event on all sources posted to this bug report: nodejs/node#14102
Summary: D8954324 added code to catch and log errors in ws and httpServer. I found in nodejs/node#14102 that a request can throw `ECONNRESET` after it ends OK, what might cause the server to crash. Reviewed By: hansonw Differential Revision: D8960971 fbshipit-source-id: 0233b14a580f021d72b71c179a73884976d26881
Didnt get any useful answers, some wrote about request, someone about ws, socket, etc. |
For my case it was because of mysql "wait_timeout" value. Somehow if you open a mysql pool and didn't close it for 8 hours. Look here for more info: https://stackoverflow.com/questions/22900931/mysql-giving-read-econnreset-error-after-idle-time-on-node-js-server/22906189#22906189 |
The issue was originally posted here.
I used https.request to visit an intranet server, and response is OK. But after 10 minutes no action on my side, still got ECONNRESET error and process crashed.
req.on('error')
not working at all.response data received
response end
!!!!!!!!!!!!!!!!!!!!!! uncaughtException !!!!!!!!!!!!!!!!!!!
{ Error: read ECONNRESET at exports._errnoException (util.js:1050:11) at TCP.onread (net.js:582:26) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }
I also tried using keep-alive agent/default globalAgent/no agent, and even listened 'error','end' of 'socket' event, but none of these prevented application from crashing. Only process.on('uncaughtException') can catch this error but obviously it's not the recommended way for error handling.
Code:
The text was updated successfully, but these errors were encountered: