-
Notifications
You must be signed in to change notification settings - Fork 291
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
How to catch ECONNRESET? #705
Comments
|
@bnoordhuis BTW, I tried using with or without keep-alive agent, and even listened socket event 'error'/'close' when Please suggest. |
Does it happen with the latest node.js 8? What you describe sounds like a bug that was fixed some time ago. |
@bnoordhuis |
Close by mistake |
@bnoordhuis I tried NodeJS 8, and got error again. |
@bnoordhuis please suggest if I need to open an issue in nodejs/node. |
Do you get 'error' and 'end' events? If yes, which one comes first? If no, file a bug but please include a ready-to-run test case. |
@bnoordhuis I added event for res.on('end') and req.on('error'). 'end' got triggered, but 'error' never get triggered as I mentioned above. I'll fire a bug but not sure if I can find a proper URL to reappear this issue as the current URL is in my Intranet. |
I'm experiencing something similar (see my comment in this issue). This may also be related to this issue. I've posted code that reproduces the error (albeit, after a 5 or 10 minute wait) in the linked comment above. Edit: Oh, just realised that this isn't the |
nodejs/node#14102 |
I used this block of code and for now it seems to work,
|
ashtro-0 you're a life saver. |
I use https.request to read from server, and the response is fine. But after several minutes, ECONNRESET error crash the application. My question is, besides process.on('uncaughtException') (not recommended by Nodejs), is there a proper way to catch and handle ECONNRESET for https.request?
{ Error: read ECONNRESET at exports._errnoException (util.js:1050:11) at TCP.onread (net.js:582:26) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }
Below is my code.
` var options = {
method: 'GET',
hostname: hostname,
path: url,
auth: username + ':' + password,
ca: [fs.readFileSync(path.resolve(__dirname, '../common/cer.cer'))],
}
The text was updated successfully, but these errors were encountered: