You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am very rarely experiencing ELIFECYCLE error and I suspect it is caused by a needle.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-06-15T08_41_46_354Z-debug.log
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xxx-xxx-xxx-xxx@0.0.0 start script.
npm ERR! xxx-xxx-xxx-xxx@0.0.0 start: `node ./server.js`
npm ERR! errno 1
throw er; // Unhandled 'error' event
at TLSWrap.onerror (_tls_wrap.js:416:11)
at TLSSocket._emitTLSError (_tls_wrap.js:888:10)
at TLSSocket.EventEmitter.emit (domain.js:467:12)
at TLSSocket.emit (events.js:315:20)
at TLSSocket.socketErrorListener (_http_client.js:469:9)
Emitted 'error' event on ClientRequest instance at:
Error
^
events.js:292
at TLSWrap.callbackTrampoline (internal/async_hooks.js:131:14)\
Whenever this error appears it is only always after a successful request when using needle. At least the 5 times it happened during the last 2 months every time I got a 200 response just before the crash. I suppose it is possible, that after a successful request an error can still be emitted. Correct me if im wrong.
I do have a very heavy traffic and the reproduction rate is <0.1%
After going deeper in to the source code I found this block in lib/needle.js. I guess this is the part where a successful request is being handled:
functiondone(err,resp){if(returned++>0)returndebug('Already finished, stopping here.');if(timer)clearTimeout(timer);request.removeListener('error',had_error);if(callback)returncallback(err,resp,resp ? resp.body : undefined);// NOTE: this event used to be called 'end', but the behaviour was confusing// when errors ocurred, because the stream would still emit an 'end' event.out.emit('done',err);}
Note the line 465: request.removeListener('error', had_error);
This removes the 'error' event listener from http.RequestClient that needle uses.
Could this be that needle removes 'error' event listener and for some unknown reasons http.ClientRequest tries to emit an 'error' afterwards?
Because if so, an aplication is going to crash nonetheless.
If an EventEmitter does not have at least one listener registered for the 'error' event, and an 'error' event is emitted, the error is thrown, a stack trace is printed, and the Node.js process exits.
Thanks in advance
The text was updated successfully, but these errors were encountered:
Hi.
I am very rarely experiencing ELIFECYCLE error and I suspect it is caused by a needle.
Whenever this error appears it is only always after a successful request when using needle. At least the 5 times it happened during the last 2 months every time I got a 200 response just before the crash. I suppose it is possible, that after a successful request an error can still be emitted. Correct me if im wrong.
I do have a very heavy traffic and the reproduction rate is <0.1%
After going deeper in to the source code I found this block in lib/needle.js. I guess this is the part where a successful request is being handled:
Note the line 465: request.removeListener('error', had_error);
This removes the 'error' event listener from http.RequestClient that needle uses.
Could this be that needle removes 'error' event listener and for some unknown reasons http.ClientRequest tries to emit an 'error' afterwards?
Because if so, an aplication is going to crash nonetheless.
Here is a reference to Event Emitter: https://nodejs.org/api/events.html
It states that
If an EventEmitter does not have at least one listener registered for the 'error' event, and an 'error' event is emitted, the error is thrown, a stack trace is printed, and the Node.js process exits.
Thanks in advance
The text was updated successfully, but these errors were encountered: