Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SentryCrashMonitor_MachException crashes on macOS #1589

Open
sindresorhus opened this issue Dec 26, 2021 · 11 comments · Fixed by #2662
Open

SentryCrashMonitor_MachException crashes on macOS #1589

sindresorhus opened this issue Dec 26, 2021 · 11 comments · Fixed by #2662

Comments

@sindresorhus
Copy link

sindresorhus commented Dec 26, 2021

Environment

Sentry SaaS (sentry.io)

Sentry Cocoa 7.7.0

Steps to Reproduce

  1. Look at this report: https://sentry.io/organizations/sindresorhus/issues/2884292704/events/a191dd6573534c37aa3b87fd18430a52/
  2. Notice how it crashed in "Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_MachException.c:266"
  libsystem_kernel    0x189c29954  mach_msg_trap
  libsystem_kernel    0x189c29cfc  mach_msg
  Lungo               0x10024cb20  handleExceptions (Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_MachException.c:266)
  libsystem_pthread   0x189c6523c  _pthread_start

Expected Result

I expected the crash monitor to not crash.

Actual Result

It crashed.

The crash happened for a random user. I cannot reproduce it myself.

@philipphofmann
Copy link
Member

Thanks for reporting this @sindresorhus. I noticed that KSCrash has a few fixes for KSCrashMonitor_MachException over the past year, that we don't include in SentryCrash. I think we should apply those fixes to your repo.

@github-actions
Copy link

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@sindresorhus
Copy link
Author

Please keep this open.

@georges
Copy link

georges commented Sep 10, 2022

@sindresorhus
Copy link
Author

I had to remove Sentry from one of my apps as there were too many random crashes caused by Sentry itself.

For example: https://sentry.io/organizations/sindresorhus/issues/3474609924/events/578f5959e32b4da18217e6af63587102/

@philipphofmann
Copy link
Member

I'm sorry about that, @sindresorhus. I will bump the priority for this issue.

@philipphofmann
Copy link
Member

philipphofmann commented Jan 30, 2023

#2662 could fix this, but I'm not sure, as the crash happened

// Wait for a message.
kern_return_t kr = mach_msg(&exceptionMessage.header, MACH_RCV_MSG, 0,
sizeof(exceptionMessage), g_exceptionPort, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);

but we didn't change the code there with #2662

@philipphofmann
Copy link
Member

@sindresorhus, do you still see this crash happening? If yes, can you provide us with a link?

@philipphofmann philipphofmann moved this from Needs Discussion to In Progress in Mobile & Cross Platform SDK Jan 30, 2023
@philipphofmann philipphofmann moved this from In Progress to Backlog in Mobile & Cross Platform SDK Mar 1, 2023
@philipphofmann philipphofmann removed their assignment Jul 21, 2023
@brustolin brustolin moved this from Backlog to Needs Investigation in Mobile & Cross Platform SDK Oct 4, 2023
@philipphofmann
Copy link
Member

philipphofmann commented Dec 1, 2023

@sindresorhus, sorry for getting back to you so late. I checked our internal SDK crashes and see around 50 crashes like that still happening in the past 90 days. It also occurs in v 8.x.

As pointed out by me above, the crash happens while waiting for mach messages. This may happen after closing the SDK, and we don't correctly clear up our mach exception handler. Do you call SentrySDK.close somewhere in your code?

Internal note for further investigation: We made some changes to enable and disable the mach exception handler in this PR #2440, released with 7.31.3 in Nov 2022.

@philipphofmann philipphofmann moved this from Needs Investigation to Needs More Information in Mobile & Cross Platform SDK Dec 1, 2023
@getsantry getsantry bot moved this to Waiting for: Community in GitHub Issues with 👀 Dec 1, 2023
@sindresorhus
Copy link
Author

Do you call SentrySDK.close somewhere in your code?

No

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 Dec 1, 2023
@philipphofmann philipphofmann moved this from Needs More Information to Needs Discussion in Mobile & Cross Platform SDK Dec 1, 2023
@getsantry getsantry bot removed the status in GitHub Issues with 👀 Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: Needs Discussion
Development

Successfully merging a pull request may close this issue.

5 participants