Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
**Features**:

- No longer write the deprecated `sentry.transaction` and `db.system` attributes. ([#6237](https://github.com/getsentry/relay/pull/6237), [#6238](https://github.com/getsentry/relay/pull/6238))
- Allow additional exceptions in minidump and apple crash report events. ([#6241](https://github.com/getsentry/relay/pull/6241))

## 26.7.0

Expand Down
3 changes: 0 additions & 3 deletions relay-dynamic-config/src/feature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ pub enum Feature {
/// See <https://getsentry.github.io/objectstore/rust/objectstore_service/multipart/>.
#[serde(rename = "projects:relay-upload-multipart")]
UploadMultipart,
/// Allow additional exceptions to accompany minidumps.
#[serde(rename = "projects:minidump-multi-exception")]
MinidumpMultiException,
Comment on lines -110 to -112

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No need to add this to GRADUATED_FEATURE_FLAGS: The feature flag was only used for minidumps, for which the native placeholder was only ever written in processing relays.

/// Enable relay billing outcome generation.
#[serde(rename = "organizations:relay-generate-billing-outcome")]
GenerateBillingOutcome,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl SentryError for AppleCrashReport {
utils::if_processing!(ctx, {
crate::utils::process_apple_crash_report(
event.get_or_insert_with(Default::default),
ctx.processing.project_info,
crate::utils::AdditionalExceptions::Retain,
);
metrics.bytes_ingested_event_applecrashreport =
(apple_crash_report.len() as u64).into();
Expand Down
4 changes: 3 additions & 1 deletion relay-server/src/processing/errors/errors/minidump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use crate::managed::{Counted, Quantities, RecordKeeper};
use crate::processing::ForwardContext;
use crate::processing::errors::errors::{Context, Expansion, SentryError, utils};
use crate::processing::errors::{Error, Result};
#[cfg(feature = "processing")]
use crate::utils::AdditionalExceptions;

#[derive(Debug)]
pub struct Minidump(pub Item);
Expand All @@ -29,7 +31,7 @@ impl SentryError for Minidump {
crate::utils::process_minidump(
event.get_or_insert_with(Default::default),
&minidump,
ctx.processing.project_info,
AdditionalExceptions::Retain,
);
metrics.bytes_ingested_event_minidump = (minidump.attachment_body_size() as u64).into();
});
Expand Down
2 changes: 1 addition & 1 deletion relay-server/src/processing/errors/errors/playstation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl SentryError for Playstation {
// If the original prosperodump is already rate limited, so will be the minidump.
item.set_rate_limited(prosperodump.rate_limited());

crate::utils::process_minidump(event.get_or_insert_with(Event::default), &item, ctx.processing.project_info);
crate::utils::process_minidump(event.get_or_insert_with(Event::default), &item, crate::utils::AdditionalExceptions::Delete);
Comment thread
sentry[bot] marked this conversation as resolved.

item
};
Expand Down
7 changes: 4 additions & 3 deletions relay-server/src/processing/errors/errors/unreal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use crate::managed::{Counted, Quantities, RecordKeeper};
use crate::processing::ForwardContext;
use crate::processing::errors::Result;
use crate::processing::errors::errors::{Context, Expansion, SentryError, utils};
#[cfg(feature = "processing")]
use crate::utils::AdditionalExceptions;

#[derive(Debug)]
pub enum UnrealReport {
Expand Down Expand Up @@ -102,14 +104,13 @@ impl SentryError for Unreal {
if let Some(minidump) = &minidump {
crate::utils::process_minidump(
event.get_or_insert_with(Default::default),
minidump,
ctx.processing.project_info
minidump, AdditionalExceptions::Delete
);
metrics.bytes_ingested_event_minidump = (minidump.attachment_body_size() as u64).into();
}
if let Some(acr) = &apple_crash_report {
crate::utils::process_apple_crash_report(
event.get_or_insert_with(Default::default), ctx.processing.project_info
event.get_or_insert_with(Default::default), AdditionalExceptions::Delete
);
Comment thread
jjbayer marked this conversation as resolved.
metrics.bytes_ingested_event_applecrashreport = (acr.len() as u64).into();
}
Expand Down
27 changes: 17 additions & 10 deletions relay-server/src/utils/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ use chrono::{TimeZone, Utc};
use minidump::{
MinidumpAnnotation, MinidumpCrashpadInfo, MinidumpModuleList, Module, StabilityReport,
};
use relay_dynamic_config::Feature;
use relay_event_schema::protocol::{
ClientSdkInfo, Context, Contexts, Event, Exception, JsonLenientString, Level, Mechanism,
StabilityReportContext, Values,
};
use relay_protocol::{Annotated, Value, get_value};

use crate::envelope::{Item, ItemType};
use crate::services::projects::project::ProjectInfo;

type Minidump<'a> = minidump::Minidump<'a, &'a [u8]>;

Expand All @@ -40,6 +38,13 @@ struct NativePlaceholder {
mechanism_type: &'static str,
}

#[derive(Clone, Copy)]
/// What to do with additional exceptions in a minidump / apple crash report event.
pub enum AdditionalExceptions {
Retain,
Delete,
}

/// Writes a placeholder to indicate that this event has an associated minidump or an apple
/// crash report.
///
Expand All @@ -48,7 +53,7 @@ struct NativePlaceholder {
fn write_native_placeholder(
event: &mut Event,
placeholder: NativePlaceholder,
project_info: &ProjectInfo,
additional_exceptions: AdditionalExceptions,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This parameter exists to differentiate between the minidump and playstation cases?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, I got test failures on the playstation endpoint and cursor complains about unreal. We might want to get rid of this parameter eventually but I didn't want to risk breaking any of those use cases for now (it could be that they implicitly rely on the deletion).

) {
// Events must be native platform.
let platform = event.platform.value_mut();
Expand All @@ -71,21 +76,19 @@ fn write_native_placeholder(
.value_mut()
.get_or_insert_with(Vec::new);

let allow_multiple_exceptions = project_info.has_feature(Feature::MinidumpMultiException);
if let Some(exc) = exceptions.first() {
relay_log::info!(
additional_exceptions = exceptions.len(),
native_exception_mechanism = placeholder.exception_type,
Comment on lines 77 to 82

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The logic to delete additional exceptions for Playstation and Unreal events has been removed, contradicting the stated requirement in the pull request description to preserve this behavior.
Severity: MEDIUM

Suggested Fix

Re-introduce logic to clear additional exceptions for Playstation and Unreal platforms. This could be achieved by passing platform information to the write_native_placeholder function and conditionally calling exceptions.clear() based on the platform, or by adding the clearing logic directly within the specific processing paths for Playstation and Unreal.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: relay-server/src/utils/native.rs#L65-L82

Potential issue: The code change removes the mechanism that previously controlled
whether additional exceptions are kept or deleted based on a project feature flag. The
function `write_native_placeholder` in `native.rs` no longer receives `project_info` and
the logic that checked for `Feature::MinidumpMultiException` before conditionally
calling `exceptions.clear()` has been removed. The pull request description explicitly
states that Playstation and Unreal platforms should continue to have additional
exceptions deleted. However, with this change, all platforms will now unconditionally
have multiple exceptions, which contradicts the intended behavior for Playstation and
Unreal.

Also affects:

  • relay-server/src/processing/errors/errors/playstation.rs:107~113
  • relay-server/src/processing/errors/errors/unreal.rs:102~114

Did we get this right? 👍 / 👎 to inform future reviews.

additional_exception_mechanism = ?get_value!(exc.mechanism.ty),
sentry_project = ?event.project,
event_id = ?event.id,
has_feature = allow_multiple_exceptions,
platform = ?event.platform,
"Native event has additional exceptions",
)
}

if !allow_multiple_exceptions {
if matches!(additional_exceptions, AdditionalExceptions::Delete) {
exceptions.clear(); // clear previous errors if any
}

Comment thread
cursor[bot] marked this conversation as resolved.
Expand Down Expand Up @@ -223,14 +226,18 @@ fn write_crashpad_annotations(
///
/// This function operates at best-effort. It always attaches the placeholder and returns
Comment thread
jjbayer marked this conversation as resolved.
/// successfully, even if the minidump or part of its data cannot be parsed.
pub fn process_minidump(event: &mut Event, item: &Item, project_info: &ProjectInfo) {
pub fn process_minidump(
event: &mut Event,
item: &Item,
additional_exceptions: AdditionalExceptions,
) {
debug_assert_eq!(item.ty(), &ItemType::Attachment);
let placeholder = NativePlaceholder {
exception_type: "Minidump",
exception_value: "Invalid Minidump",
mechanism_type: "minidump",
};
write_native_placeholder(event, placeholder, project_info);
write_native_placeholder(event, placeholder, additional_exceptions);

if item.is_attachment_ref() {
// We don't have a full minidump, just a placeholder for something that was uploaded
Expand Down Expand Up @@ -293,11 +300,11 @@ pub fn process_minidump(event: &mut Event, item: &Item, project_info: &ProjectIn

/// Writes minimal information into the event to indicate it is associated with an Apple Crash
/// Report.
pub fn process_apple_crash_report(event: &mut Event, project_info: &ProjectInfo) {
pub fn process_apple_crash_report(event: &mut Event, additional_exceptions: AdditionalExceptions) {
let placeholder = NativePlaceholder {
exception_type: "AppleCrashReport",
exception_value: "Invalid Apple Crash Report",
mechanism_type: "applecrashreport",
};
write_native_placeholder(event, placeholder, project_info);
write_native_placeholder(event, placeholder, additional_exceptions);
}
14 changes: 4 additions & 10 deletions tests/integration/test_minidump.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,9 +714,8 @@ def test_minidump_with_processing_invalid(
]


@pytest.mark.parametrize("feature_flag", [False, True])
def test_minidump_with_event_exception(
mini_sentry, relay_with_processing, attachments_consumer, feature_flag
mini_sentry, relay_with_processing, attachments_consumer
):
"""
An envelope can carry both a minidump attachment and an event item that already
Expand All @@ -732,8 +731,6 @@ def test_minidump_with_event_exception(
project_id = 42
project_config = mini_sentry.add_full_project_config(project_id)
config = project_config["config"]
if feature_flag:
config.setdefault("features", []).append("projects:minidump-multi-exception")

# Disable scrubbing, the basic and full project configs from the mini_sentry fixture
# will modify the minidump since it contains user paths in the module list.
Expand Down Expand Up @@ -791,12 +788,9 @@ def test_minidump_with_event_exception(
assert minidump_exception["mechanism"]["type"] == "minidump"

# The user-provided exception with its stack trace must be preserved.
if feature_flag:
(user_exception,) = additional_exceptions
assert user_exception["value"] == "division by zero"
assert user_exception["stacktrace"]["frames"][0]["function"] == "divide"
else:
assert not additional_exceptions
(user_exception,) = additional_exceptions
assert user_exception["value"] == "division by zero"
assert user_exception["stacktrace"]["frames"][0]["function"] == "divide"

# The minidump must still be forwarded as an attachment.
assert any(att["name"] == "minidump.dmp" for att in message["attachments"])
Expand Down
Loading