getsentry / sentry-native

Sentry SDK for C, C++ and native applications.
MIT License
399 stars 169 forks source link

Crash still getting reported after calling sentry_close() #736

Open sandormatyi opened 2 years ago

sandormatyi commented 2 years ago

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

Environment

Steps To Reproduce

// ...initialize Sentry

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

Log output

sandormatyi commented 2 years ago

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()?

ReneGreen27 commented 2 years ago

Bump @getsentry/owners-native

Swatinem commented 2 years ago

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.

sandormatyi commented 2 years ago

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

Swatinem commented 2 years ago

I believe it will, though not 100% certain.

sandormatyi commented 2 years ago

@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?

Swatinem commented 2 years ago

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