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

attempt to fix export deadlocks #486

Merged
merged 1 commit into from
Oct 9, 2023
Merged

attempt to fix export deadlocks #486

merged 1 commit into from
Oct 9, 2023

Conversation

neildsouth
Copy link
Contributor

Description

We've seen instances where an export message with an incorrect name can halt exports and cause issues.

this adds some try/catch to the TransformBlock's on an exception it now sets the file upload to failed so the process can continue.

Status

Ready

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • All tests passed locally.
  • Documentation comments included/updated.
  • User guide updated.
  • I have updated the changelog

Signed-off-by: Neil South <neil.south@answerdigital.com>
@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

Merging #486 (90c1a40) into develop (ebb0a51) will decrease coverage by 0.03250%.
Report is 1 commits behind head on develop.
The diff coverage is 68.96552%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##             develop        #486         +/-   ##
===================================================
- Coverage   78.87427%   78.84177%   -0.03250%     
===================================================
  Files            390         390                 
  Lines          24553       24572         +19     
  Branches        1098        1098                 
===================================================
+ Hits           19366       19373          +7     
- Misses          4799        4809         +10     
- Partials         388         390          +2     
Flag Coverage Δ
unittests 78.84177% <68.96552%> (-0.03250%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...maticsGateway/Services/Export/ExportServiceBase.cs 83.17308% <68.96552%> (-2.01212%) ⬇️

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ebb0a51...90c1a40. Read the comment docs.

@@ -145,6 +145,7 @@ private async Task OnMessageReceivedCallback(MessageReceivedEventArgs eventArgs)
if (Interlocked.Read(ref _activeWorkers) >= Concurrency)
{
_logger.ExceededMaxmimumNumberOfWorkers(ServiceName, _activeWorkers);
await Task.Delay(200).ConfigureAwait(false); // small delay to stop instantly dead lettering the next message.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

between acknowledge message and releasing the Interlocked.Decrement call, new message can be received in a tight loop, sending them to the deadletter queue.

@@ -328,12 +347,12 @@ private void ReportingActionBlock(ExportRequestDataMessage exportRequestData)
_configuration.Export.Retries.RetryDelays,
(exception, timeSpan, retryCount, context) =>
{
_logger.ErrorAcknowledgingMessageWithRetry(exception, timeSpan, retryCount);
_logger.ErrorPublishingExportCompleteEventWithRetry(exception, timeSpan, retryCount);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

swapped these two around, so that the message is acknowledged last, again to help with the fact that the next message will be received before the Interlocked.Decrement is called

@neildsouth neildsouth requested a review from mocsharp October 6, 2023 16:46
@neildsouth neildsouth merged commit d77d514 into develop Oct 9, 2023
30 of 32 checks passed
@neildsouth neildsouth deleted the AI225-fixdeadlocks branch October 9, 2023 15:13
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.

3 participants