-
Notifications
You must be signed in to change notification settings - Fork 207
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: Added exception handling for S3 processing #1551
Fix: Added exception handling for S3 processing #1551
Conversation
…y condition Signed-off-by: Asif Sohail Mohammed <[email protected]>
Signed-off-by: Asif Sohail Mohammed <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #1551 +/- ##
=========================================
Coverage 94.18% 94.18%
Complexity 1181 1181
=========================================
Files 165 165
Lines 3386 3386
Branches 277 277
=========================================
Hits 3189 3189
Misses 141 141
Partials 56 56 Continue to review full report at Codecov.
|
Signed-off-by: Asif Sohail Mohammed <[email protected]>
s3Service.addS3Object(s3ObjectReference); | ||
deleteMessageBatchRequestEntry = Optional.of(buildDeleteMessageBatchRequestEntry(entry.getKey())); | ||
sqsMessageDelayTimer.record(Duration.between( | ||
Instant.ofEpochMilli(entry.getValue().get(0).getEventTime().toInstant().getMillis()), | ||
Instant.now() | ||
)); |
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.
I want to point out that we don't delete SQS message if there is an exception in S3ObjectWorker. Let me know if you have any ideas on how to improve the user experience here.
final S3ObjectReference s3ObjectReference) { | ||
Optional<DeleteMessageBatchRequestEntry> deleteMessageBatchRequestEntry = Optional.empty(); | ||
// SQS messages won't be deleted if we are unable to process S3Objects because of S3Exception: Access Denied | ||
try { |
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.
This try-catch block will suppress the exceptions thrown from #1544 . But, I'm still a little concerned that the current while(true)
loop can have other exceptions thrown from it which result in this source mysteriously shutting down.
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.
I did check for any other cases of failure. Just to be sure, I will surround processSqsMessages
in a try catch block.
Signed-off-by: Asif Sohail Mohammed <[email protected]>
final Map.Entry<Message, List<S3EventNotification.S3EventNotificationRecord>> entry, | ||
final S3ObjectReference s3ObjectReference) { | ||
Optional<DeleteMessageBatchRequestEntry> deleteMessageBatchRequestEntry = Optional.empty(); | ||
// SQS messages won't be deleted if we are unable to process S3Objects because of S3Exception: Access Denied |
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.
It might be worth creating a javadoc comment for this method to raise the visibility of this comment.
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.
I'll make this change in the upcoming PR
Instant.now() | ||
)); | ||
} catch (final Exception e) { | ||
LOG.warn("Unable to process S3Object: s3ObjectReference={}.", s3ObjectReference, e); |
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.
It might be outside the scope of this PR but it would be nice to expose the number of objects that threw exceptions as a metric.
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.
We do catch these metrics further down.
* Fix: Added exception handling for S3 processing and updated poll delay condition Signed-off-by: Asif Sohail Mohammed <[email protected]> (cherry picked from commit 406ae1e)
* Fix: Added exception handling for S3 processing and updated poll delay condition Signed-off-by: Asif Sohail Mohammed <[email protected]> (cherry picked from commit 406ae1e)
* Fix: Added exception handling for S3 processing and updated poll delay condition Signed-off-by: Asif Sohail Mohammed <[email protected]> (cherry picked from commit 406ae1e) Co-authored-by: Asif Sohail Mohammed <[email protected]>
* Fix: Added exception handling for S3 processing and updated poll delay condition Signed-off-by: Asif Sohail Mohammed <[email protected]> (cherry picked from commit 406ae1e) Co-authored-by: Asif Sohail Mohammed <[email protected]>
) * Fix: Added exception handling for S3 processing and updated poll delay condition Signed-off-by: Asif Sohail Mohammed <[email protected]> Signed-off-by: Finn Roblin <[email protected]>
) * Fix: Added exception handling for S3 processing and updated poll delay condition Signed-off-by: Asif Sohail Mohammed <[email protected]>
Signed-off-by: Asif Sohail Mohammed [email protected]
Description
maximum_messages
configuration optionIssues Resolved
Resolves #1544
Resolves #1550
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.