sentry-native icon indicating copy to clipboard operation
sentry-native copied to clipboard

JNI crash can not be capture on Windows

Open yangpanroy opened this issue 4 years ago • 1 comments

Description

I build a sentry.dll using Crashpad as backend. Then I pack it and crashpad_handler.exe in my Java project. I want to invoke the init API of sentry so it can capture the other JNI invoke crash in this process. But when I trigger a JNI crash, it looks like JVM has handled the crash and created a minidump file, and sentry.dll does nothing in this crash. Here is the output:

image

How to make sentry-native capture and report this crash, rather than handled by JVM?

When does the problem happen

  • [ ] During build
  • [ ] During run-time
  • [x] When capturing a hard crash

Environment

  • OS: [Windows 10, 64-bit]
  • Compiler: [MSVC 19]
  • CMake version and config: [SENTRY_BACKEND=crashpad]
  • JRE: [JRE 7.0_80-b15]
  • JVM: [Java Hotspot Client VM x86]

yangpanroy avatar Sep 23 '21 08:09 yangpanroy

https://github.com/getsentry/sentry-native/blob/90966cc1022b8155681b6899539b35466baccf2c/include/sentry.h#L1070-L1079

The sentry_reinstall_backend function is there specifically for the situation where another part of the program overrides the crash handlers. However, I am not entirely sure this will work in this case, it seems you initialize sentry after the JVM is already active. Which sounds like it is overriding the crash handler after the init call again. I have little experience with how JRE handles these things.

Swatinem avatar Sep 28 '21 08:09 Swatinem

Closing due to inactivity. Feel free to reopen if this issue still matters.

ashwoods avatar Nov 10 '23 12:11 ashwoods