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

ackEnv envelope kills query consumer when channel is in NoAck mode #75

Open
witoldsz opened this issue Sep 13, 2017 · 10 comments
Open

ackEnv envelope kills query consumer when channel is in NoAck mode #75

witoldsz opened this issue Sep 13, 2017 · 10 comments

Comments

@witoldsz
Copy link

In my app, by mistake, I did manually ackEnv a message received by a channel in the NoAck mode. The application did not crash, but the query consumer was silently dropped. It took me an hour to figure out what had happened. Is this a bug?

I am using Stack resolver lts-9.2, so I am at amqp-0.15.1.

@michaelklishin
Copy link
Contributor

This is not a bug. Acknowledging with an unknown delivery tag results in a channel error which closes the channel. There can be no deliveries on a closed channel and all of its state is discarded.

@michaelklishin
Copy link
Contributor

Also notifications about channel errors are asynchronous so clients cannot immediately throw an exception when a basic.ack is sent.

@hreinhardt
Copy link
Owner

You can use addChannelExceptionHandler to be notified whenever a channel is unexpectedly closed. In your case you would have got something like ConnectionClosedException "PRECONDITION_FAILED - unknown delivery tag 2". (Not sure why the error says ConnectionClosed instead of ChannelClosed; could be a bug in the ampq library. I'll take a look.)

I guess you weren't aware this function existed, so maybe there's a way we could make it more prominent.

@hreinhardt
Copy link
Owner

I added a "debugging tips" section to the docs in the newest release, to help people that have to debug similar problems in the future.

@witoldsz
Copy link
Author

Thanks for clarification. That would be nice if such errors could by, by default, displayed to STDERR until addXyzExceptionHandler is registered. That would be best of both worlds: we can decide what to do with exceptions and at the same time we would be sure nothing gets wrong without a notice.

@hreinhardt
Copy link
Owner

While I personally agree with you, in the past people have complained about the library printing stuff to the screen unprompted. So no matter what we do, we will annoy some group of people...

@michaelklishin
Copy link
Contributor

@hreinhardt in the age of logging to stdout/stderr required by some platforms I think it's more acceptable to do that. Also, when I have to debug something I personally would rather have more information about errors and suspicious events, not less.

@witoldsz
Copy link
Author

in the past people have complained about the library printing stuff to the screen unprompted

This is why I suggest that printing would be just the default action until some exception handler is registered. Once it's registered the library user would decide for themselves what to do (to log it or not, if so then how).

@hreinhardt
Copy link
Owner

OK, your arguments are definitely valid.

I think I have a rough idea how this could be implemented and I'll give it a try.

@hreinhardt
Copy link
Owner

I've pushed the implementation to master: 3363031

It seems to work in my very limited testing, but would be great if somebody else could give it a try.

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

3 participants