-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fixes session pump stop when auto-renew lock task expires #6483
Conversation
Can one of the admins verify this patch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging by Neeraj's request. |
Hi @nemakam. When do you plan to release a new version of SDK with this fix? |
Hoping to release in next couple of days. All the code changes are already in place. |
So the current work around would be increasing the MaxAutoRenewDuration ? |
Hi, yes. Just make sure that your Handler doesn't process the message longer than MaxAutoRenewDuration. If you set it to 5 minutes make sure that your handler completes in less than 5 min. |
Fixes the bug when the session handler stops processing messages if renew lock duration is less than it takes to process a message in user callback.
The code flow in
SessionReceivePump.cs
which leads to a problem looks like this:MessagePumpTaskAsync
starts a renew lock task in background and a timer to cancel this task in 1 second (the value specified inMaxAutoRenewDuration
).OnUserCallBackTimeout
is executed which cancels and disposesrenewLockCancellationTokenSource
.MessagePumpTaskAsync
is getting some exception and pops out to afinally
block which should release a semaphore. But it couldn't do it because of exceptionObjectDisposedException
when trying to cancel already disposed (in step 2)renewLockCancellationTokenSource
.Reproduction program
It sends a few messages in different sessions and then tries to receive them. The gotcha here is that processing a message takes longer than LockDuration and AutorenewLockDuration.
Expected: session pump indefinitely tries to process messages without stopping.
Actual: after the first message the pump is stuck and don't try to process new messages.
P.S. this problem is already fixed in MessageReceivePump.cs#L190 but in SessionReceivePump it was overlooked.