{"action":"created","issue":{"url":"https://api.github.com/repos/yahoo/pulsar/issues/100","repository_url":"https://api.github.com/repos/yahoo/pulsar","labels_url":"https://api.github.com/repos/yahoo/pulsar/issues/100/labels{/name}","comments_url":"https://api.github.com/repos/yahoo/pulsar/issues/100/comments","events_url":"https://api.github.com/repos/yahoo/pulsar/issues/100/events","html_url":"https://github.com/yahoo/pulsar/issues/100","id":186613555,"number":100,"title":"Consumers blocked with 0 availablePermits","user":{"login":"sschepens","id":3072509,"avatar_url":"https://avatars.githubusercontent.com/u/3072509?v=3","gravatar_id":"","url":"https://api.github.com/users/sschepens","html_url":"https://github.com/sschepens","followers_url":"https://api.github.com/users/sschepens/followers","following_url":"https://api.github.com/users/sschepens/following{/other_user}","gists_url":"https://api.github.com/users/sschepens/gists{/gist_id}","starred_url":"https://api.github.com/users/sschepens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sschepens/subscriptions","organizations_url":"https://api.github.com/users/sschepens/orgs","repos_url":"https://api.github.com/users/sschepens/repos","events_url":"https://api.github.com/users/sschepens/events{/privacy}","received_events_url":"https://api.github.com/users/sschepens/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2016-11-01T18:43:24Z","updated_at":"2016-11-09T22:57:20Z","closed_at":null,"body":"When a consumer with `ackTimeout` connects, it negotiates a given amount of permits with broker (say 1000), it then receives 1000 messages. At this point the consumer has 0 `availablePermits` and 1000 `unackedMessages`, If no one pulls these messages from this consumer, they are eventually redelivered to the broker, now the broker schedules redelivery of those messages, but never increments `availablePermits` for the consumer, leaving the consumer stuck with 0 `availablePermits`.\r\n\r\nThis happens at least with perMessageRedelivery, as a redelivery does not necessarily imply that permits have to be granted to the consumer. Unfortunately, I don't know if the Broker can really do something here. \r\n\r\nI believe this issue is a consequence of a consumer asking for redelivery of messages that have never been pulled from the queue.\r\n\r\nThe best approach seems to be for the consumer to ask for more permits when this is the case.\r\nWhat do you think?\r\n"},"comment":{"url":"https://api.github.com/repos/yahoo/pulsar/issues/comments/259551042","html_url":"https://github.com/yahoo/pulsar/issues/100#issuecomment-259551042","issue_url":"https://api.github.com/repos/yahoo/pulsar/issues/100","id":259551042,"user":{"login":"merlimat","id":62500,"avatar_url":"https://avatars.githubusercontent.com/u/62500?v=3","gravatar_id":"","url":"https://api.github.com/users/merlimat","html_url":"https://github.com/merlimat","followers_url":"https://api.github.com/users/merlimat/followers","following_url":"https://api.github.com/users/merlimat/following{/other_user}","gists_url":"https://api.github.com/users/merlimat/gists{/gist_id}","starred_url":"https://api.github.com/users/merlimat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/merlimat/subscriptions","organizations_url":"https://api.github.com/users/merlimat/orgs","repos_url":"https://api.github.com/users/merlimat/repos","events_url":"https://api.github.com/users/merlimat/events{/privacy}","received_events_url":"https://api.github.com/users/merlimat/received_events","type":"User","site_admin":false},"created_at":"2016-11-09T22:57:20Z","updated_at":"2016-11-09T22:57:20Z","body":"I agree on that, the library should be playing with the permits to do that, but I'd keep it separate from this PR, because:  \r\n 1. It might be tricky to make sure we don't forget any corner case and leave the delivery stopped\r\n 2. It should not be super-awful anyway.. you get 1000 messages resent every n-minutes\r\n\r\n"}}
{"actor":{"display_login":"merlimat"}}