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

Run the Consumer MessageHandler in a Task #250

Merged
merged 24 commits into from
Mar 29, 2023
Merged

Conversation

Gsantomaggio
Copy link
Member

@Gsantomaggio Gsantomaggio commented Mar 9, 2023

Thanks to @Zerpet for help and to @jonnepmyra for rasing the issue and testing the pr
Fixes #246

Run the Consumer MessageHandler in a Task

The chunks are now processed in a separate Task
In this way, the socket thread is free to handle other requests like ConsumerUpdate

Convert DispatchMessage method from void to async Task

DispatchMessage is now an async task by removing the wait the code is aync

lukebakken and others added 3 commits March 9, 2023 10:46
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
@codecov
Copy link

codecov bot commented Mar 9, 2023

Codecov Report

Patch coverage: 84.00% and project coverage change: -0.15 ⚠️

Comparison is base (10cd0c9) 93.00% compared to head (05b6fba) 92.86%.

❗ Current head 05b6fba differs from pull request most recent head 8be1829. Consider uploading reports for the commit 8be1829 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #250      +/-   ##
==========================================
- Coverage   93.00%   92.86%   -0.15%     
==========================================
  Files         102      102              
  Lines        8725     8871     +146     
  Branches      673      704      +31     
==========================================
+ Hits         8115     8238     +123     
- Misses        471      489      +18     
- Partials      139      144       +5     
Impacted Files Coverage Δ
RabbitMQ.Stream.Client/Reliable/Consumer.cs 100.00% <ø> (ø)
RabbitMQ.Stream.Client/Client.cs 90.99% <50.00%> (ø)
RabbitMQ.Stream.Client/Consts.cs 66.66% <50.00%> (-33.34%) ⬇️
RabbitMQ.Stream.Client/Connection.cs 88.65% <57.89%> (-5.10%) ⬇️
RabbitMQ.Stream.Client/RawConsumer.cs 85.49% <84.71%> (+1.40%) ⬆️
RabbitMQ.Stream.Client/Deliver.cs 95.94% <100.00%> (+0.49%) ⬆️
RabbitMQ.Stream.Client/Message.cs 91.25% <100.00%> (+0.46%) ⬆️
RabbitMQ.Stream.Client/RoutingClient.cs 94.11% <100.00%> (+0.36%) ⬆️
RabbitMQ.Stream.Client/WireFormatting.cs 78.80% <100.00%> (+0.83%) ⬆️
Tests/ClientTests.cs 97.38% <100.00%> (ø)
... and 3 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
@Gsantomaggio Gsantomaggio changed the title Task message handler Run the Consumer MessageHandler in a Task Mar 11, 2023
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
@Gsantomaggio Gsantomaggio marked this pull request as ready for review March 11, 2023 21:48
@Gsantomaggio Gsantomaggio added this to the 1.3.0 milestone Mar 11, 2023
lukebakken and others added 5 commits March 12, 2023 17:24
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Gsantomaggio and others added 4 commits March 14, 2023 12:05
Fixes #247
Add credit request when a consumer is promoted

Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Fixes #247
Add credit request when a consumer is promoted

Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
Copy link
Contributor

@lukebakken lukebakken left a comment

Choose a reason for hiding this comment

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

I've reviewed once but want to re-read again!

@Gsantomaggio Gsantomaggio marked this pull request as draft March 15, 2023 06:43
@Gsantomaggio
Copy link
Member Author

Thank you, @lukebakken. I convert the pr into a draft. I am working with @jonnepmyra to validate it; it has yet to be ready.

when the consumer is not promoted anymore

Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
…tream-dotnet-client into task_message_handler
Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
@jonnepmyra
Copy link
Contributor

Been testing this in many different scenarios the last week, and the current state of this PR is a huge improvement that solves multiple problems that've experienced when using SuperStreams.

Some examples of problems that's been solved:

  • Deadlocks for slow consumers
  • Running out of credits on multiple "single active consumer" switches
  • None of the consumers where activated (== all consumers is "stuck" in a "waiting" status)
  • Consumer connections that were silently dropped

We're still struggling with cases of "all consumers are stuck in waiting status", but this happends alot less frequently with this PR, and seems to correlate with heavy load in RabbitMQ (or possibly the host of the application instance) and more investigation is needed (Will continue a separate discussion with @Gsantomaggio about this, since it seems to be out of context of this PR and very hard to reproduce).

@lukebakken lukebakken self-requested a review March 17, 2023 14:17
request is called.

Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
…tream-dotnet-client into task_message_handler
request is called. Handle the cancellation on the connection level

Signed-off-by: Gabriele Santomaggio <G.santomaggio@gmail.com>
@Gsantomaggio Gsantomaggio marked this pull request as ready for review March 27, 2023 16:29
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

Successfully merging this pull request may close these issues.

Single Active consumer blocked in Waiting Status
4 participants