-
Notifications
You must be signed in to change notification settings - Fork 589
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
cloud_storage: Handle nested benign exception #10909
Merged
jcsp
merged 1 commit into
redpanda-data:dev
from
abhijat:handle-nested-exception-logging
Jun 2, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2023 Redpanda Data, Inc. | ||
* | ||
* Licensed as a Redpanda Enterprise file under the Redpanda Community | ||
* License (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* https://github.com/redpanda-data/redpanda/blob/master/licenses/rcl.md | ||
*/ | ||
|
||
#include "cloud_storage_clients/util.h" | ||
|
||
#include <boost/test/unit_test.hpp> | ||
|
||
BOOST_AUTO_TEST_CASE(test_nested_exception) { | ||
{ | ||
auto inner = std::make_exception_ptr(ss::abort_requested_exception{}); | ||
auto outer = std::make_exception_ptr(ss::gate_closed_exception{}); | ||
ss::nested_exception ex{inner, outer}; | ||
BOOST_REQUIRE( | ||
cloud_storage_clients::util::has_abort_or_gate_close_exception(ex)); | ||
} | ||
|
||
{ | ||
auto inner = std::make_exception_ptr(std::bad_alloc{}); | ||
auto outer = std::make_exception_ptr(ss::gate_closed_exception{}); | ||
ss::nested_exception ex{inner, outer}; | ||
BOOST_REQUIRE( | ||
cloud_storage_clients::util::has_abort_or_gate_close_exception(ex)); | ||
} | ||
|
||
{ | ||
auto inner = std::make_exception_ptr(std::invalid_argument{""}); | ||
auto outer = std::make_exception_ptr( | ||
ss::no_sharded_instance_exception{}); | ||
ss::nested_exception ex{inner, outer}; | ||
BOOST_REQUIRE( | ||
!cloud_storage_clients::util::has_abort_or_gate_close_exception(ex)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just curious, do you know where this was being thrown? Just want to make sure we need to worry about unwrapping the other exception types
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.
also curious about this. is this something we all need to be on the look out for?
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 specific instance was during a put object request handled by the s3 client:
In the same time frame there were several other put requests which seem to have failed but the error logging correctly logged them as DEBUG but the nested instance got logged as error:
AFAIK the issue here is how we classify and log exceptions in
handle_client_transport_error
so it should be enough to handle this specifically in this function?Could you expand on this? Do you mean we should be handling the nested types differently?
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.
@abhijat thanks for the response. to clarify my question: might we have other places where a nested exception is being thrown but not handled correctly by unwrapping its inner/outer components.
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.
@dotnwat initially as mentioned in my comment here I assumed that we only need to handle this in the cloud storage client where we classify log levels, but now thinking more about it, anywhere we handle abort requested or gate closed exceptions differently from general exceptions, we may also need to examine nested exceptions to see if they should be classified as abort requested/gate closed.
This pattern is in a few places in the tree (for example, searching for
handle_exception_type([](const ss::abort_requested_exception
yields a few results) so I suspect there are more places where we should be unwrapping nested exceptions.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.
🙏