Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,16 @@ private RequestBody makeErrorTrackingRequestBody(@Nonnull CrashLog payload, bool
writer.name("si_signo_human_readable").value(payload.sigInfo.name);
writer.name("si_signo").value(payload.sigInfo.number);
}
if (payload.sigInfo.action != null) {
Copy link
Contributor

@amarziali amarziali Mar 19, 2026

Choose a reason for hiding this comment

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

question: are those field accepted by the current schema? I don't see si_pid and si_uid: https://github.com/DataDog/libdatadog/blob/main/docs/RFCs/0005-crashtracker-structured-log-format.md#fields

writer.name("si_code").value(payload.sigInfo.code);
writer.name("si_code_human_readable").value(payload.sigInfo.action);
}
if (payload.sigInfo.pid != null) {
writer.name("si_pid").value(payload.sigInfo.pid);
}
if (payload.sigInfo.uid != null) {
writer.name("si_uid").value(payload.sigInfo.uid);
}
writer.endObject();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,27 @@ public class SigInfo {
@Json(name = "si_addr")
public final String address;

public SigInfo(Integer number, String name, Integer code, String action, String address) {
@Json(name = "si_pid")
public final Integer pid;

@Json(name = "si_uid")
public final Integer uid;

public SigInfo(
Integer number,
String name,
Integer code,
String action,
String address,
Integer pid,
Integer uid) {
this.number = number;
this.name = name;
this.address = address;
this.code = code;
this.action = action;
this.pid = pid;
this.uid = uid;
}

@Override
Expand All @@ -35,11 +50,13 @@ public boolean equals(Object o) {
&& Objects.equals(name, sigInfo.name)
&& Objects.equals(address, sigInfo.address)
&& Objects.equals(code, sigInfo.code)
&& Objects.equals(action, sigInfo.action);
&& Objects.equals(action, sigInfo.action)
&& Objects.equals(pid, sigInfo.pid)
&& Objects.equals(uid, sigInfo.uid);
}

@Override
public int hashCode() {
return Objects.hash(number, name, address, code, action);
return Objects.hash(number, name, address, code, action, pid, uid);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ public HotspotCrashLogParser() {
private static final Pattern SPACE_SPLITTER = Pattern.compile("\\s+");
private static final Pattern NEWLINE_SPLITTER = Pattern.compile("\n");
private static final Pattern SIGNAL_PARSER = Pattern.compile("\\s*(\\w+) \\((\\w+)\\).*");
// Groups: 1=si_signo, 2=signal name, 3=si_code, 4=si_code name,
// 5=si_addr (null for SI_USER), 6=si_pid (null for si_addr), 7=si_uid (null for si_addr)
private static final Pattern SIGINFO_PARSER =
Pattern.compile(
"siginfo:\\s+si_signo:\\s+(\\d+)\\s+\\((\\w+)\\),\\s+si_code:\\s+(\\d+)\\s+\\(([^)]+)\\),\\s+si_addr:\\s+(0x[0-9a-fA-F]+)");
"siginfo:\\s+si_signo:\\s+(\\d+)\\s+\\((\\w+)\\),\\s+si_code:\\s+(\\d+)\\s+\\(([^)]+)\\),\\s+"
+ "(?:si_addr:\\s+(0x[0-9a-fA-F]+)|si_pid:\\s+(\\d+),\\s+si_uid:\\s+(\\d+))");
private static final Pattern DYNAMIC_LIBS_PATH_PARSER =
Pattern.compile("^(?:0x)?[0-9a-fA-F]+(?:-[0-9a-fA-F]+)?\\s+(?:[^\\s/\\[]+\\s+)*(.*)$");

Expand Down Expand Up @@ -275,16 +278,18 @@ public CrashLog parse(String uuid, String crashLog) {
break;
case STACKTRACE:
if (line.startsWith("siginfo:")) {
// siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr:
// 0x0000000000000070
// siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x70
// siginfo: si_signo: 11 (SIGSEGV), si_code: 0 (SI_USER), si_pid: 554848, si_uid: 1000
final Matcher siginfoMatcher = SIGINFO_PARSER.matcher(line);
if (siginfoMatcher.matches()) {
Integer number = safelyParseInt(siginfoMatcher.group(1));
String name = siginfoMatcher.group(2);
Integer siCode = safelyParseInt(siginfoMatcher.group(3));
String sigAction = siginfoMatcher.group(4);
String address = siginfoMatcher.group(5);
sigInfo = new SigInfo(number, name, siCode, sigAction, address);
Integer siPid = safelyParseInt(siginfoMatcher.group(6));
Integer siUid = safelyParseInt(siginfoMatcher.group(7));
sigInfo = new SigInfo(number, name, siCode, sigAction, address, siPid, siUid);
}
} else if (line.contains("P R O C E S S")) {
state = State.SEEK_DYNAMIC_LIBRARIES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ private SigInfo buildSigInfo(String eventType, String eventCode) {
signalNumber = parseEventCode(eventCode);
}

return new SigInfo(signalNumber, signalName, null, null, null);
return new SigInfo(signalNumber, signalName, null, null, null, null, null);
}

private int parseEventCode(String eventCode) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"timestamp":"2024-09-20T13:19:06Z","ddsource":"crashtracker","error":{"is_crash":true,"type":"UNKNOWN","message":"Process terminated by signal UNKNOWN","source_type":"Crashtracking","stack":{"format":"CrashTrackerV1","frames":[{"function":"__pthread_clockjoin_ex+0x255","path":"libpthread.so.0","relative_address":"0x9cd5"}]}}}
{"timestamp":"2024-09-20T13:19:06Z","ddsource":"crashtracker","error":{"is_crash":true,"type":"SIGSEGV","message":"Process terminated by signal SIGSEGV","source_type":"Crashtracking","stack":{"format":"CrashTrackerV1","frames":[{"function":"__pthread_clockjoin_ex+0x255","path":"libpthread.so.0","relative_address":"0x9cd5"}]}},"sig_info":{"si_signo_human_readable":"SIGSEGV","si_signo":11,"si_code":0,"si_code_human_readable":"SI_USER","si_pid":554848,"si_uid":1000}}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"data_schema_version":"1.0","error":{"is_crash":true,"kind":"UNKNOWN","message":"Process terminated by signal UNKNOWN","source_type":"Crashtracking","stack":{"format":"CrashTrackerV1","frames":[{"function":"__pthread_clockjoin_ex+0x255","path":"libpthread.so.0","relative_address":"0x9cd5"}]}},"incomplete":false,"metadata":{"family":"java","library_name":"dd-trace-java","library_version":"1.60.0-SNAPSHOT~cffe9c6085"},"os_info":{"architecture":"aarch64","bitness":"64","os_type":"Mac OS X","version":{"Semantic":[15,7,1]}},"proc_info":{"pid":576034},"timestamp":"2024-09-20T13:19:06Z","uuid":"a4194cd6-8cb3-45fd-9bd9-3af83e0a3ad3","version_id":0}
{"data_schema_version":"1.0","error":{"is_crash":true,"kind":"SIGSEGV","message":"Process terminated by signal SIGSEGV","source_type":"Crashtracking","stack":{"format":"CrashTrackerV1","frames":[{"function":"__pthread_clockjoin_ex+0x255","path":"libpthread.so.0","relative_address":"0x9cd5"}]}},"incomplete":false,"metadata":{"family":"java","library_name":"dd-trace-java","library_version":"1.60.0-SNAPSHOT~cffe9c6085"},"os_info":{"architecture":"aarch64","bitness":"64","os_type":"Mac OS X","version":{"Semantic":[15,7,1]}},"proc_info":{"pid":576034},"sig_info":{"si_code":0,"si_code_human_readable":"SI_USER","si_pid":554848,"si_signo":11,"si_signo_human_readable":"SIGSEGV","si_uid":1000},"timestamp":"2024-09-20T13:19:06Z","uuid":"a4194cd6-8cb3-45fd-9bd9-3af83e0a3ad3","version_id":0}
Loading