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

Fix a bug in cooperative cancellation for Polling Services causing a request to time out to quickly #558

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

nathanwoctopusdeploy
Copy link
Contributor

@nathanwoctopusdeploy nathanwoctopusdeploy commented Nov 27, 2023

Background

This PR fixes a bug in cooperative cancellation for Polling Requests which cause the transferring request to be cancelled after the PollingRequestQueueTimeout rather than waiting for the PollingRequestMaximumMessageProcessingTimeout

[sc-58429]

How to review this PR

Quality ✔️

Pre-requisites

  • I have read How we use GitHub Issues for help deciding when and where it's appropriate to make an issue.
  • I have considered informing or consulting the right people, according to the ownership map.
  • I have considered appropriate testing for my change.

@nathanwoctopusdeploy nathanwoctopusdeploy changed the title Fix a bug in cooperative cancellation for Polling Request causing a request to be cancelled before it should be Fix a bug in cooperative cancellation for Polling Services causing a request to be cancelled before it should be Nov 27, 2023
@@ -59,13 +59,6 @@ public static LatestClientAndLatestServiceBuilder WithInstantReconnectPollingRet
{
return builder.WithPollingReconnectRetryPolicy(() => new RetryPolicy(1, TimeSpan.Zero, TimeSpan.Zero));
}

public static LatestClientAndLatestServiceBuilder WhenTestingAsyncClient(this LatestClientAndLatestServiceBuilder builder, ClientAndServiceTestCase clientAndServiceTestCase, Action<LatestClientAndLatestServiceBuilder> action)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed as everything is Async

{
return false;
}

using (await transferLock.LockAsync(CancellationToken.None))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ensure there is no race condition allowing a just cancelled request to be dequeued

if (completed)
// Check if the request has already been completed or if the request has been cancelled
// to ensure we don't dequeue an already completed or already cancelled request
if (completed || pendingRequestCancellationTokenSource.IsCancellationRequested)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ensure there is no race condition allowing a just cancelled request to be dequeued

@nathanwoctopusdeploy nathanwoctopusdeploy changed the title Fix a bug in cooperative cancellation for Polling Services causing a request to be cancelled before it should be Fix a bug in cooperative cancellation for Polling Services causing a request to time out to quickly Nov 27, 2023
Copy link
Contributor

@sburmanoctopus sburmanoctopus left a comment

Choose a reason for hiding this comment

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

LGTM

@nathanwoctopusdeploy nathanwoctopusdeploy force-pushed the sast/fix-co-operative-cancellation branch from 84b11a9 to a3427ee Compare November 27, 2023 22:51
@nathanwoctopusdeploy nathanwoctopusdeploy enabled auto-merge (squash) November 27, 2023 22:53
@nathanwoctopusdeploy nathanwoctopusdeploy merged commit 79841cf into main Nov 28, 2023
1 check passed
@nathanwoctopusdeploy nathanwoctopusdeploy deleted the sast/fix-co-operative-cancellation branch November 28, 2023 00:23
nathanwoctopusdeploy added a commit that referenced this pull request Nov 28, 2023
…using a request to time out to quickly (#558)"

This reverts commit 79841cf.
sburmanoctopus pushed a commit that referenced this pull request Nov 29, 2023
* Revert "Fix a bug in cooperative cancellation for Polling Services causing a request to time out to quickly (#558)"

This reverts commit 79841cf.

* Revert "Co-operatively cancel all RPC Calls (#525)"

This reverts commit 1bde8c8.
@nathanwoctopusdeploy nathanwoctopusdeploy restored the sast/fix-co-operative-cancellation branch December 5, 2023 10:23
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.

2 participants