{"action":"opened","issue":{"url":"https://api.github.com/repos/SOHU-Co/kafka-node/issues/160","labels_url":"https://api.github.com/repos/SOHU-Co/kafka-node/issues/160/labels{/name}","comments_url":"https://api.github.com/repos/SOHU-Co/kafka-node/issues/160/comments","events_url":"https://api.github.com/repos/SOHU-Co/kafka-node/issues/160/events","html_url":"https://github.com/SOHU-Co/kafka-node/issues/160","id":57481585,"number":160,"title":"BrokerNotAvailableError: Broker not available","user":{"login":"MayhemYDG","id":567105,"avatar_url":"https://avatars.githubusercontent.com/u/567105?v=3","gravatar_id":"","url":"https://api.github.com/users/MayhemYDG","html_url":"https://github.com/MayhemYDG","followers_url":"https://api.github.com/users/MayhemYDG/followers","following_url":"https://api.github.com/users/MayhemYDG/following{/other_user}","gists_url":"https://api.github.com/users/MayhemYDG/gists{/gist_id}","starred_url":"https://api.github.com/users/MayhemYDG/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MayhemYDG/subscriptions","organizations_url":"https://api.github.com/users/MayhemYDG/orgs","repos_url":"https://api.github.com/users/MayhemYDG/repos","events_url":"https://api.github.com/users/MayhemYDG/events{/privacy}","received_events_url":"https://api.github.com/users/MayhemYDG/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-12T16:17:57Z","updated_at":"2015-02-12T16:17:57Z","closed_at":null,"body":"Reduced test case:\r\n\r\n1. Launch the following code.\r\n2. Wait a moment to let the client connect to kafka.\r\n3. ^C\r\n4. Program crashes.\r\n\r\n```js\r\nvar kafka    = require('kafka-node');\r\nvar client   = new kafka.Client('localhost:2181');\r\nvar consumer = new kafka.Consumer(client, []);\r\nconsumer.addTopics(['admin'], function(err) {\r\n  if (err) console.error(log);\r\n});\r\nprocess.once('SIGINT', function() {\r\n  consumer.close();\r\n});\r\n```\r\n\r\n\r\n```\r\n$ iojs test.js \r\n^C\r\nevents.js:125\r\n      throw er; // Unhandled 'error' event\r\n            ^\r\nBrokerNotAvailableError: Broker not available\r\n    at new BrokerNotAvailableError (/vagrant/kiseki-api/node_modules/kafka-node/lib/errors/BrokerNotAvailableError.js:11:11)\r\n    at Socket.<anonymous> (/vagrant/kiseki-api/node_modules/kafka-node/lib/client.js:501:43)\r\n    at emitOne (events.js:75:13)\r\n    at Socket.emit (events.js:150:7)\r\n    at TCP.close (net.js:457:12)\r\n```\r\n\r\nThis only happens with `kafka-node@0.2.19`, `kafka-node@0.2.18` exits gracefully.\r\nIt also happens with `client.close()` instead of `consumer.close()`."}}