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

Crash still getting reported after calling sentry_close()

Open sandormatyi opened this issue 3 years ago • 7 comments

Description

I have an application that I sometimes want to manually crash without the crash getting reported. I am calling sentry_close() before the crash happens but the crash still ends up getting processed and reported.

When does the problem happen

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

Environment

  • OS: Windows 10, 64-bit
  • Compiler: MSVC 19
  • CMake version and config: 3.22,0 SENTRY_BACKEND=crashpad

Steps To Reproduce

// ...initialize Sentry

sentry_close();
*((int*)(nullptr)) = 1;

Log output

sandormatyi avatar Jul 21 '22 15:07 sandormatyi

The documentation is not clear about sentry_close() being synchronous or asynchronous so I'm assuming the former. Do I have to wait for some amount of time after calling sentry_close()?

sandormatyi avatar Jul 21 '22 15:07 sandormatyi

Bump @getsentry/owners-native

ReneGreen27 avatar Jul 26 '22 19:07 ReneGreen27

You mention that you are using the crashpad backend on Windows. On that configuration, it is unfortunately not possible to de-register the crash handler. All other backends seem to handle that correctly though.

Swatinem avatar Jul 27 '22 09:07 Swatinem

@Swatinem Do you have a workaround in mind that you could recommend? Would revoking user consent prevent the crash from being processed by Sentry?

sandormatyi avatar Jul 27 '22 09:07 sandormatyi

I believe it will, though not 100% certain.

Swatinem avatar Jul 27 '22 09:07 Swatinem

@Swatinem Unfortunately, sentry_user_consent_revoke() doesn't work either. The crashes after revoking user consent are still sent to the Sentry server. This doesn't sound right to me. Is this the expected behaviour? Am I missing something here?

sandormatyi avatar Jul 29 '22 09:07 sandormatyi

That is a good point, we will have to investigate. In the meanwhile using a different backend is a good workaround.

Swatinem avatar Aug 01 '22 07:08 Swatinem