Skip to content

Conversation

moikot
Copy link
Contributor

@moikot moikot commented Sep 5, 2025

Problem: A race during shutdown could call reader.AdvanceTo(buffer.Start, buffer.End) after the TCP socket is closed, risking exceptions that propagate via reader.CompleteAsync(caught) and noisy logs.
Change: In Connection.ProcessIncomingFrames, only call reader.AdvanceTo(...) when socket.Connected is true.

Problem: A race during shutdown could call reader.AdvanceTo(buffer.Start, buffer.End) after the TCP socket is closed, risking exceptions that propagate via reader.CompleteAsync(caught) and noisy logs.
Change: In Connection.ProcessIncomingFrames, only call reader.AdvanceTo(...) when socket.Connected is true.
@moikot
Copy link
Contributor Author

moikot commented Sep 5, 2025

I’m not sure how to test this, but I see that every time I close a consumer, an InvalidOperationException is thrown from reader.AdvanceTo.

Copy link
Member

@Gsantomaggio Gsantomaggio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @moikot 👋 Thank you for contributing to this client. Recently (a month ago), our company made some changes around open source contribution, and now it's required that you sign a contributor license agreement (CLA) before we can accept your PR.

The process is explained here in this repo README: https://github.com/rabbitmq/cla

Would you review and sign this CLA?

@Gsantomaggio
Copy link
Member

the code looks good btw!

@moikot
Copy link
Contributor Author

moikot commented Sep 5, 2025

@Gsantomaggio Thank you for reviewing the fix and pointing me to the README! I'll start the process immediately!

@Gsantomaggio Gsantomaggio added this to the 1.9.2 milestone Sep 5, 2025
@Gsantomaggio Gsantomaggio merged commit c75f4d5 into rabbitmq:main Sep 5, 2025
2 checks passed
@Gsantomaggio
Copy link
Member

Thanks @moikot

@moikot
Copy link
Contributor Author

moikot commented Sep 5, 2025

Thank you, @Gsantomaggio, for the prompt review and for accepting my PR ☺️

@Gsantomaggio Gsantomaggio self-assigned this Sep 5, 2025
@Gsantomaggio Gsantomaggio added the enhancement New feature or request label Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants