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
After stopping a kafka instance (I have 2 running instances under normal conditions), node prints the following output and then terminates the process:
events.js:160
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED 127.0.0.1:9093
at Object.exports._errnoException (util.js:1026:11)
at exports._exceptionWithHostPort (util.js:1049:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)
I attached 'error' event handlers on all the Client, Offset and Consumer objects that I've manually instantiated.
If I setup a global error handler, then the process doesn't terminate and the consumer happily continues receiving messages from the remaining broker.
process.on('uncaughtException',(err)=>{console.log('whoops! there was an error',err.stack);});
So, it creates an internal new Offset object, that newly offset has not attached an 'error' event handler, so when Client emits an error it aborts the process because the offset re-emits the event but no one is listening to it.
The solution seems to be to not create a new Offset and just invoke self.fetch(...), or don't re-emit Client error events forcing the user to handle those events with Client#on.
This problem does not occur if I don't invoke Offset#fetchLatestOffsets. I'm using v1.0.7
Any thoughts?
The text was updated successfully, but these errors were encountered:
After stopping a kafka instance (I have 2 running instances under normal conditions), node prints the following output and then terminates the process:
I attached 'error' event handlers on all the Client, Offset and Consumer objects that I've manually instantiated.
If I setup a global error handler, then the process doesn't terminate and the consumer happily continues receiving messages from the remaining broker.
In Client#fetchLatestOffsets (the app is invoking this method) there are the following lines:
https://github.com/SOHU-Co/kafka-node/blob/master/lib/offset.js#L91
So, it creates an internal new
Offset
object, that newly offset has not attached an 'error' event handler, so when Client emits an error it aborts the process because the offset re-emits the event but no one is listening to it.https://github.com/SOHU-Co/kafka-node/blob/master/lib/offset.js#L18
The solution seems to be to not create a new
Offset
and just invokeself.fetch(...)
, or don't re-emit Client error events forcing the user to handle those events withClient#on
.This problem does not occur if I don't invoke
Offset#fetchLatestOffsets
. I'm using v1.0.7Any thoughts?
The text was updated successfully, but these errors were encountered: