Skip to content

Commit 6310244

Browse files
authored
fix(native): Fix crash daemon premature exit on Windows (#1600)
* fix(native): Fix daemon exiting after 5s on Windows due to insufficient process handle access * Update changelog
1 parent 67be232 commit 6310244

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
- Fix `cache_keep` to only cache envelopes when HTTP send fails, instead of unconditionally on restart. ([#1585](https://github.com/getsentry/sentry-native/pull/1585))
1313
- Fix external crash reporter to work with the new experimental `native` backend. ([#1589](https://github.com/getsentry/sentry-native/pull/1589))
14+
- Fix crash daemon premature exit on Windows ([#1600](https://github.com/getsentry/sentry-native/pull/1600))
1415

1516
## 0.13.3
1617

src/backends/native/sentry_crash_daemon.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2879,8 +2879,10 @@ is_parent_alive(pid_t parent_pid)
28792879
// Send signal 0 to check if process exists
28802880
return kill(parent_pid, 0) == 0 || errno != ESRCH;
28812881
#elif defined(SENTRY_PLATFORM_WINDOWS)
2882-
// Open handle to process with minimum rights
2883-
HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, parent_pid);
2882+
// Open handle to process - need PROCESS_QUERY_LIMITED_INFORMATION
2883+
// for GetExitCodeProcess, plus SYNCHRONIZE for WaitForSingleObject
2884+
HANDLE hProcess = OpenProcess(
2885+
SYNCHRONIZE | PROCESS_QUERY_LIMITED_INFORMATION, FALSE, parent_pid);
28842886
if (!hProcess) {
28852887
return false; // Process doesn't exist or can't be accessed
28862888
}

0 commit comments

Comments
 (0)