Skip to content
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

after close is called, throws uncaughtException: write after end #412

Open
kumar-b opened this issue Jul 26, 2016 · 1 comment
Open

after close is called, throws uncaughtException: write after end #412

kumar-b opened this issue Jul 26, 2016 · 1 comment

Comments

@kumar-b
Copy link

kumar-b commented Jul 26, 2016

Here is the stack trace of the uncaught exception.

Tue Jul 26 2016 15:18:25 GMT+0530 (IST) - error: uncaughtException: write after end date=Tue Jul 26 2016 15:18:25 GMT+0530 (IST), pid=563, uid=0, gid=0, cwd=/home/kafka/consumer/node-server, execPath=/home/kafka/consumer/node-server/node, version=v4.4.5, argv=[/home/kafka/consumer/node-server/node, /home/kafka/consumer/node-server/index.js], rss=55496704, heapTotal=41443168, heapUsed=30733056, loadavg=[0.22216796875, 0.23681640625, 0.216796875], uptime=2520106
Error: write after end
    at writeAfterEnd (_stream_writable.js:166:12)
    at Socket.Writable.write (_stream_writable.js:211:5)
    at Socket.write (net.js:626:40)
    at BrokerWrapper.write (/home/kafka/consumer/node-server/node_modules/kafka-node/lib/wrapper/BrokerWrapper.js:26:15)
    at Client.loadMetadataForTopics (/home/kafka/consumer/node-server/node_modules/kafka-node/lib/client.js:270:10)
    at RetryOperation._fn (/home/kafka/consumer/node-server/node_modules/kafka-node/lib/client.js:389:12)
    at RetryOperation.attempt (/home/kafka/consumer/node-server/node_modules/kafka-node/node_modules/retry/lib/retry_operation.js:56:8)
    at attemptRequestMetadata (/home/kafka/consumer/node-server/node_modules/kafka-node/lib/client.js:387:15)
    at Client.refreshMetadata (/home/kafka/consumer/node-server/node_modules/kafka-node/lib/client.js:383:3)
    at null.<anonymous> (/home/kafka/consumer/node-server/node_modules/kafka-node/lib/consumer.js:84:10)

Anyone facing similar issue?
I'm using following to close the consumer connection. The callback gives no error.
consumer.close(true, callback)

@kumar-b kumar-b changed the title after close is called throws uncaughtException: write after end after close is called, throws uncaughtException: write after end Jul 26, 2016
@ech0-de
Copy link

ech0-de commented Mar 4, 2017

Do you use the same client for multiple consumers, or are you also calling client.close(cb)?

I had the same issue and found that consumer.close also calls client.close. Therefore when the client is closed before the consumer finished committing the offsets, the write after end error will occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants