{"action":"closed","issue":{"url":"https://api.github.com/repos/oleksiyk/kafka/issues/62","repository_url":"https://api.github.com/repos/oleksiyk/kafka","labels_url":"https://api.github.com/repos/oleksiyk/kafka/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/oleksiyk/kafka/issues/62/comments","events_url":"https://api.github.com/repos/oleksiyk/kafka/issues/62/events","html_url":"https://github.com/oleksiyk/kafka/issues/62","id":155119852,"number":62,"title":"Producer sometimes throws (rejects promise) `UnknownTopicOrPartition`","user":{"login":"jotto","id":16573,"avatar_url":"https://avatars.githubusercontent.com/u/16573?v=3","gravatar_id":"","url":"https://api.github.com/users/jotto","html_url":"https://github.com/jotto","followers_url":"https://api.github.com/users/jotto/followers","following_url":"https://api.github.com/users/jotto/following{/other_user}","gists_url":"https://api.github.com/users/jotto/gists{/gist_id}","starred_url":"https://api.github.com/users/jotto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jotto/subscriptions","organizations_url":"https://api.github.com/users/jotto/orgs","repos_url":"https://api.github.com/users/jotto/repos","events_url":"https://api.github.com/users/jotto/events{/privacy}","received_events_url":"https://api.github.com/users/jotto/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-05-16T20:55:21Z","updated_at":"2016-05-19T18:26:18Z","closed_at":"2016-05-19T18:26:18Z","body":"When a Kafka leader is `kill -9`'d, the producer has inconsistent behavior.\r\n\r\n* most of the time the `producer.send()` promise is fulfilled and no error is returned\r\n* some of the time the `producer.send()` promise is rejected with `UnknownTopicOrPartition`. It looks like it might be coming from here https://github.com/oleksiyk/kafka/blob/067c48dfc7787788120dc2f983286aa9200df248/lib/client.js#L228 (the metadata had just finished updating but was set to the now `kill -9`'d broker)\r\n\r\nAssuming my observations are correct, I would further assume that `Producer.prototype._send` needs some kind of wrapper/retry around [`_prepareProduceRequest`](https://github.com/oleksiyk/kafka/blob/067c48dfc7787788120dc2f983286aa9200df248/lib/producer.js#L87) - but maybe this design was intentional."}}