-
Notifications
You must be signed in to change notification settings - Fork 118
fix(objectstore): Do not log errors for client aborts #6064
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ use crate::services::outcome::DiscardReason; | |
| use crate::services::store::{Store, StoreAttachment, StoreEnvelope, StoreTraceItem}; | ||
| use crate::services::upload::ByteStream; | ||
| use crate::statsd::{RelayCounters, RelayTimers}; | ||
| use crate::utils::{BoundedStream, MeteredStream, RetryableStream, TakeOnce}; | ||
| use crate::utils::{BoundedStream, MeteredStream, RetryableStream, TakeOnce, find_error_source}; | ||
|
|
||
| use super::outcome::Outcome; | ||
|
|
||
|
|
@@ -175,6 +175,9 @@ impl Error { | |
| type = kind.as_str(), | ||
| attempts = self.attempts.to_string(), | ||
| ); | ||
| if self.kind.is_client_error() { | ||
| return; | ||
| } | ||
| relay_log::error!( | ||
| error = &self.kind as &dyn std::error::Error, | ||
| amount = self.amount, | ||
|
|
@@ -222,6 +225,15 @@ impl ErrorKind { | |
| Self::Uuid(_) => "uuid", | ||
| } | ||
| } | ||
|
|
||
| fn is_client_error(&self) -> bool { | ||
| match self { | ||
| ErrorKind::UploadFailed(objectstore_client::Error::Reqwest(error)) => { | ||
| find_error_source(error, is_user_error).is_some() | ||
| } | ||
| _ => false, | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Client abort detection too narrowMedium Severity
Additional Locations (1)Reviewed by Cursor Bugbot for commit 6324cba. Configure here.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's OK, I want to start conservatively and relax the condition if necessary. |
||
| } | ||
| } | ||
|
|
||
| impl OutcomeError for Error { | ||
|
|
@@ -742,6 +754,15 @@ fn is_retryable(error: &objectstore_client::Error) -> bool { | |
| } | ||
| } | ||
|
|
||
| fn is_user_error(error: &(dyn std::error::Error + 'static)) -> bool { | ||
| error.downcast_ref::<std::io::Error>().is_some_and(|error| { | ||
| matches!( | ||
| error.kind(), | ||
| std::io::ErrorKind::FileTooLarge | std::io::ErrorKind::UnexpectedEof | ||
| ) | ||
| }) | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use relay_system::Service; | ||
|
|
||


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 is the code change that suppresses error logs for client errors.