Conversation
mujacica
commented
Oct 29, 2025
- Sentry native crash backend
- Out-of-process daemon/handler
- MacOS/Android/Windows/Linux support
- Integration with external crash reporter
- IPC/SHM/Signaling multi-platform implementation
- Minidump writers for all platforms
- In-process option (process_crash function)
- Different options for Minidump sizes
- Full sentry-codebase integration
- Sentry logger integration
- Sentry debug-flags integration
|
@sentry review |
1 similar comment
|
@sentry review |
216b3cd to
e4cd98c
Compare
|
@sentry review |
|
@cursor review |
|
@cursor review |
d634773 to
eb77775
Compare
|
@sentry review |
d46d50a to
d38b5e1
Compare
d33258f to
71ea60d
Compare
|
79d2b05 to
a6af7d6
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix prepared fixes for all 3 issues found in the latest run.
- ✅ Fixed: macOS fallback path leaves corrupt minidump files on disk
- Added unlink(output_path) calls to all 10 error return paths in the macOS fallback code path to properly clean up partial/corrupt minidump files.
- ✅ Fixed: Duplicate sources in sentry-crash executable build target
- Removed explicit addition of sentry_crash_daemon.c and sentry_crash_ipc.c from CMakeLists.txt since they are already included via ${SENTRY_SOURCES}.
- ✅ Fixed: Per-module fsync degrades crash minidump writing performance
- Removed redundant fsync call inside the module loop since the final fsync after the loop ensures all data is committed.
Or push these changes by commenting:
@cursor push f75e3461ae
Preview (f75e3461ae)
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -752,8 +752,6 @@
# Create daemon executable with same sources plus daemon-specific files
add_executable(sentry-crash
${SENTRY_SOURCES}
- src/backends/native/sentry_crash_daemon.c
- src/backends/native/sentry_crash_ipc.c
src/backends/native/sentry_crash_context.h
)
diff --git a/src/backends/native/minidump/sentry_minidump_linux.c b/src/backends/native/minidump/sentry_minidump_linux.c
--- a/src/backends/native/minidump/sentry_minidump_linux.c
+++ b/src/backends/native/minidump/sentry_minidump_linux.c
@@ -1243,11 +1243,9 @@
ssize_t written2 = write(writer->fd, &cv_rva, sizeof(cv_rva));
if (written1 == sizeof(cv_size) && written2 == sizeof(cv_rva)) {
- // Force flush to disk
- fsync(writer->fd);
SENTRY_DEBUGF(
" Updated module[%zu]: name_rva=0x%x, cv_rva=0x%x, "
- "cv_size=%u (flushed)",
+ "cv_size=%u",
i, name_rva, cv_rva, cv_size);
} else {
SENTRY_WARNF("Failed to write CV record for module %zu: "
diff --git a/src/backends/native/minidump/sentry_minidump_macos.c b/src/backends/native/minidump/sentry_minidump_macos.c
--- a/src/backends/native/minidump/sentry_minidump_macos.c
+++ b/src/backends/native/minidump/sentry_minidump_macos.c
@@ -1013,6 +1013,7 @@
if (lseek(writer.fd, writer.current_offset, SEEK_SET) < 0) {
SENTRY_WARN("write_minidump: lseek failed");
close(writer.fd);
+ unlink(output_path);
return -1;
}
@@ -1023,36 +1024,42 @@
if (write_system_info_stream(&writer, &directories[0]) < 0) {
SENTRY_WARN("write_minidump: system_info failed");
close(writer.fd);
+ unlink(output_path);
return -1;
}
SENTRY_DEBUG("write_minidump: writing misc_info stream");
if (write_misc_info_stream(&writer, &directories[1]) < 0) {
SENTRY_WARN("write_minidump: misc_info failed");
close(writer.fd);
+ unlink(output_path);
return -1;
}
SENTRY_DEBUG("write_minidump: writing thread_list stream");
if (write_thread_list_stream(&writer, &directories[2]) < 0) {
SENTRY_WARN("write_minidump: thread_list failed");
close(writer.fd);
+ unlink(output_path);
return -1;
}
SENTRY_DEBUG("write_minidump: writing exception stream");
if (write_exception_stream(&writer, &directories[3]) < 0) {
SENTRY_WARN("write_minidump: exception failed");
close(writer.fd);
+ unlink(output_path);
return -1;
}
SENTRY_DEBUG("write_minidump: writing module_list stream");
if (write_module_list_stream(&writer, &directories[4]) < 0) {
SENTRY_WARN("write_minidump: module_list failed");
close(writer.fd);
+ unlink(output_path);
return -1;
}
SENTRY_DEBUG("write_minidump: writing memory_list stream");
if (write_memory_list_stream(&writer, &directories[5]) < 0) {
SENTRY_WARN("write_minidump: memory_list failed");
close(writer.fd);
+ unlink(output_path);
return -1;
}
SENTRY_DEBUG("write_minidump: all streams written");
@@ -1062,6 +1069,7 @@
if (lseek(writer.fd, 0, SEEK_SET) < 0) {
SENTRY_WARN("write_minidump: lseek to beginning failed");
close(writer.fd);
+ unlink(output_path);
return -1;
}
@@ -1076,6 +1084,7 @@
if (write(writer.fd, &header, sizeof(header)) != sizeof(header)) {
SENTRY_WARN("write_minidump: header write failed");
close(writer.fd);
+ unlink(output_path);
return -1;
}
@@ -1085,6 +1094,7 @@
!= sizeof(directories)) {
SENTRY_WARN("write_minidump: directory write failed");
close(writer.fd);
+ unlink(output_path);
return -1;
}Fix clang-format violations in ARM64 PAC macros and register code. Improve batcher flush logic: snapshot last_enqueue_ms before sleeping and compare after waking to detect idle buffers, replacing the 2x idle threshold that broke timer-based flush tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… drop per-module fsync - macOS minidump fallback path: use goto cleanup to unlink partial files on error instead of just closing the fd, matching the full path behavior - CMakeLists.txt: remove duplicate sentry_crash_daemon.c and sentry_crash_ipc.c from sentry-crash target (already in SENTRY_SOURCES) - Linux minidump: remove per-module fsync inside module loop, keeping only the final fsync after all modules are written Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
…er idle flush - CMakeLists: copy all compile definitions from sentry target to sentry-crash daemon so shared sources compile under identical preprocessor conditions (backend, transport, unwinder, etc.) - minidump_common: write header directly instead of via write_data to avoid corrupting current_offset when seeking back to position 0 - minidump_linux: add uint32_t RVA overflow guard before seek+patch loop - batcher: replace snapshot-and-compare with idle time check (1s threshold) to correctly flush partial buffers that have been sitting idle, even when items were enqueued during the sleep period Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
…ro stack_start_out on alloc failure - current_offset was uint32_t, making the > UINT32_MAX check always false. Widening to uint64_t lets the guard actually detect overflow. - write_thread_stack now zeros *stack_start_out on malloc failure, matching the macOS counterpart. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
… structs The previous commit widened current_offset to uint64_t in the base struct but not in the Linux/macOS platform structs, causing a layout mismatch that corrupted the crash_ctx pointer on every write_data call. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
…permissions - aarch64 Linux: use struct field access (uctx->uc_mcontext.regs[i], .sp, .pc) instead of raw pointer indexing that skipped fault_address, causing every register value to be shifted by one - Windows: request PROCESS_DUP_HANDLE when opening crashed process in FULL mode, needed for MiniDumpWithHandleData Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
…rning on aarch64 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- write_data: seek back on partial write to keep fd position in sync with current_offset - write_module_list_stream: bail early if initial module list write fails (rva==0) to prevent patching into header area - thread_context.size: only set non-zero when write_thread_context succeeds, preventing invalid location descriptors pointing at offset 0 (Linux and macOS, 5 locations) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
…g write sync - Update thread_context.size after ptrace re-write in Linux minidump writer so it stays consistent with the RVA - Validate bytes_read matches requested size in macOS read_task_memory to detect partial reads - Seek back on partial padding write in write_data to keep fd position in sync with current_offset Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
- macOS SMART mode now only captures the crash-address region instead of all readable+writable regions, matching Linux behavior and the ~5-10MB target documented in the API - Cap per-region size to 4MB (was 64MB) to match Linux - Add UINT32_MAX overflow check in write_data to prevent silent RVA truncation when minidumps exceed 4GB in FULL mode Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
- Fix minidump OS platform IDs to match Breakpad MDOSPlatform standard: Linux 0x8201, macOS 0x8101, iOS 0x8102, Android 0x8203. Previous values (0x8000-0x8003) caused server-side misidentification. - Fix write_thread_stack to find non-main thread stacks by falling back to anonymous rw-p mappings when no named [stack] mapping is found. On Linux, only the main thread stack is labeled [stack] in /proc/pid/maps; all other thread stacks are anonymous. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
…CE order - Guard malloc(0) when module_count is zero to avoid implementation- defined NULL return being treated as allocation failure - Add MiscInfoStream (with process_id) to the full macOS minidump path, matching the fallback path and ensuring consistent server-side processing - Move _XOPEN_SOURCE definition before all system header includes so ucontext_t is properly exposed on strict POSIX systems Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
