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

Ack/nack hangs when channel is closed after cancellation #423

Open
ThomWright opened this issue Dec 20, 2024 · 4 comments
Open

Ack/nack hangs when channel is closed after cancellation #423

ThomWright opened this issue Dec 20, 2024 · 4 comments

Comments

@ThomWright
Copy link

When a channel gets cancelled with basic_cancel() while messages are being processed, then:

  • When in the Closing state, calling nack() on a delivery returns an error as expected: invalid channel state: Closing.
  • After the channel gets closed and removed, the call to nack() never resolves.

I suspect this is somewhat similar to #409, maybe?

I can try to put together a reproducing example if that's helpful.

@Keruspe
Copy link
Collaborator

Keruspe commented Dec 20, 2024

This is very interesting thanks.
A reproducer would be appreciated to speed up the debugging

@ThomWright
Copy link
Author

Will do!

I've been unable to reproduce with a smaller example, so I'll need to dig deeper.

@ThomWright
Copy link
Author

I can only reproduce inside a #[tokio::test]. Inside #[tokio::main] it seems to work just fine! 😕

At this point I'm suspecting that this is some tokio/executor/runtime-related "I'm holding it wrong" issue, and probably not a lapin issue! So feel free to ignore/close if you suspect the same.

I've made a repro here with both a main function and a test function if you're interested.

@matt961
Copy link

matt961 commented Jan 4, 2025

I can only reproduce inside a #[tokio::test]. Inside #[tokio::main] it seems to work just fine! 😕

Perhaps it is related to a deadlock of tasks on single thread runtime. https://docs.rs/tokio/latest/tokio/attr.test.html#current-thread-runtime

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