getsentry / sentry-cocoa

The official Sentry SDK for iOS, tvOS, macOS, watchOS.
https://sentry.io/for/cocoa/
MIT License
798 stars 314 forks source link

Crash reports not generated on watchOS #406

Closed jostster closed 1 year ago

jostster commented 4 years ago

Platform:

Swift:

sentry-cocoa installed with:

Version of sentry-cocoa: 4.5.0


I have following issue: I have sentry installed in the watchkitextension and enabled. When I trigger a crash with Client.shared?.crash() it crashes but isn't generating a report. I am monitoring the files via the simulator. I am running in the simulator but without the debugger attached and looking at the process logs through Console.


2020-03-12 14:53:07.317602-0500 WatchCrashlytics WatchKit Extension[10206:10166742] Sentry - Debug:: SentryCrashHandler started
2020-03-12 14:53:07.323403-0500 WatchCrashlytics WatchKit Extension[10206:10166742] Sentry - Debug:: Sent 0 crash report(s)```

**Steps to reproduce:**
- I created a new watchkit + iphone app in Xcode. I then followed https://sentry.io/under-armour-l7/under-armour-l7/getting-started/cocoa-swift/.

**Actual result:**
- No crash reports are generated

**Expected result:**
- Crash reports should be generated
jostster commented 4 years ago

I have also tried this on 5.0.0-alpha.4 as well and it does not seem to run the [SentryCrash install]. Adding breakpoints it shows it runs through [SentryCrashInstallation install] but never actually goes into any of those methods, just seems to roll over them.

HazAT commented 4 years ago

@jostster Can you share your example app with Sentry installed so we can reproduce this? Thanks

jostster commented 4 years ago

@HazAT is there an email address I can send it to?

HazAT commented 4 years ago

My firstname @ sentry.io

philipphofmann commented 4 years ago

Any new updates on this @HazAT or @jostster? Can you try it with version 5.x.x and let us know if you still have the issue present?

st3fan commented 4 years ago

@HazAT How can I help to debug this? Running Sentry 5.1.8 on watchOS 6.2.8. Events reported with SentrySDK.capture(message: "Hello") arrive, but SentrySDK.crash() does not. I'm testing on device, not attached to the debugger.

mu99el commented 4 years ago

Hey all, any updates on this issue? Have the same issues like @st3fan : SentrySDK.capture(message: "Hello") works, but SentrySDK.crash() not. Tested with different Watch Models and Simulator.

philipphofmann commented 4 years ago

Thanks, @st3fan and @mu99el for reaching out to us about this issue. We are going to take a look soon and come back to you.

philipphofmann commented 4 years ago

@mu99el thanks for reporting this. I can reproduce the issue. We are trying to fix this, but I can't give you an ETA at the moment.

philipphofmann commented 4 years ago

We update the Readme https://github.com/getsentry/sentry-cocoa/pull/632 and our official docs for https://github.com/getsentry/sentry-docs/pull/1924 to have clear expectations for all devs at the moment.

LiMuBei commented 3 years ago

Any progress on this? It feels like one is left quite alone when developing watchOS apps... :)

philipphofmann commented 3 years ago

Sorry @LiMuBei no progress update on this one. Maybe we can learn from this issue https://github.com/firebase/firebase-ios-sdk/issues/4558 and this PR https://github.com/firebase/firebase-ios-sdk/pull/6262.

aaronpearce commented 3 years ago

You may want to update your watchOS marketing page if this is still unavailable. I signed up thinking crash reporting was available until I found in the documentation that it wasn't in reality.

bruno-garcia commented 3 years ago

@aaronpearce Apologies for the confusion. We'll update the marketing pages to clarify the state of the support.

triplef commented 2 years ago

We’re running into the same issue after following your documentation to integrate Sentry v7.2.8 into our watchOS app. Very misleading.

Is there a timeline when this is expected to be resolved?

bruno-garcia commented 2 years ago

This was a regression to the docs (making content reusable between "Apple platforms") and again showed the crash bits for watchOS. Sorry once again for the confusion

philipphofmann commented 2 years ago

Sorry about the confusion @triplef; I opened up a PR to fix this on the docs: https://github.com/getsentry/sentry-docs/pull/4175.

github-actions[bot] commented 2 years ago

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 πŸ₯€

albertinad commented 2 years ago

Is there any ETA on when Sentry SDK for watchOS would handle and report crashes? We are using Sentry in our technology stack, but if it still doesn't support handling crashes we would need to use another service in our watchOS app :( Thanks!

philipphofmann commented 2 years ago

Sorry to hear that @albertinad. I can't give you an ETA at the moment. You asking for this definitely gives this a bit of a higher priority.

EmDee commented 2 years ago

@philipphofmann If asking is giving this a bit higher priority, then I'm asking as well.

The docs are extremely confusing, as they seem to be auto-generated for all OS', e.g. https://docs.sentry.io/platforms/apple/guides/watchos/ has two small hints that crash handling is not supported, but then there is this big Crash handling section in here. Same goes for the marketing in https://sentry.io/for/watchos.

You should definitely communicate this more clearly.

philipphofmann commented 2 years ago

Thanks for pointing that out, @EmDee. I raised an issue (https://github.com/getsentry/static-sites/issues/779) to fix this for our marketing https://sentry.io/for/watchos/. The repository for static sites is internal, though.

I also opened up a PR for the docs to remove the section on crash handling to avoid confusion https://github.com/getsentry/sentry-docs/pull/4448.

philipphofmann commented 2 years ago

Have a look at KSCrash. Maybe they already added it.

weakfl commented 2 years ago

Any update on this? We're evaluating to migrate from Crashlytics to Sentry and also assumed that watchOS is fully supported.

philipphofmann commented 2 years ago

Sorry, we don't have an update on this as not many people ask for this. I'm happy to hear that you are evaluating moving to Sentry @weakfl. Is this a blocker for you?

weakfl commented 2 years ago

not many people ask for this.

That kind of surprises me considering the ever increasing number of watchOS users.

Is this a blocker for you?

Well, kind of @philipphofmann. But given the lack of alternatives besides Crashlytics we'll probably have to make do. I hope you'll consider adding supporting for watchOS crashes nonetheless.

philipphofmann commented 2 years ago

Of course, we consider adding support for watchOS crashes at some point, but right now, we don't see many people asking for it, which is why it has a lower priority. We are always happy to accept PRs if you are up for it.

LiMuBei commented 2 years ago

Just been going through the code a little to understand what it would take to implement this, but it's quite a large codebase to digest :) I've found an interesting comment though: https://github.com/getsentry/sentry-cocoa/blob/e47eea57ef97e9b1a949a230b74219587619c33f/Sources/SentryCrash/Recording/SentryCrashSystemCapabilities.h#L130 And it seems due to this watchOS is excluded in the following define which seems to disable the crash reporting functionality. The respective commit for this is apparently 4 years old. Maybe this is not true anymore? I'm also wondering what this refers to? watchOS version 3.1?

brustolin commented 2 years ago

@LiMuBei, that's exactly the problem. You can enable it back, at least for the last WatchOS version, looks like it is working based on some tests I've done. But we need to investigate it further to determine since which version it is ok to enable it, and if there is no other issue related to it, before we fix this in the SDK

trevorturk commented 2 years ago

we don't see many people asking for it

I'm just chiming in to ask for watchOS support! Thank you!

bradmartin commented 2 years ago

@philipphofmann - not a blocker for us as we use Sentry in many production apps and love the insights we gain. This would have been great last week during a WatchOS global app launch. We ended up having a bug in our internationlization code reading the locale identifier and parsing the region correctly. So we had reports of an app crash outside of the US with no crashes being reported it took us a long time to track down what was happening as it wasn't clear since the app went thru testflight tests without issue globally. Just voicing my support for providing crash captures in WatchOS πŸ‘πŸ» keep up the great work.

yolpsoftware commented 2 years ago

Please add this.

LiMuBei commented 2 years ago

I tested simply re-enabling the functionality on watchOS and it yielded a funky result: while running the app in the simulator or a real watch from XCode, it worked. But when I built a Testflight version and tried to use it, the app crashed during startup with this crash log:

S Version:          Watch OS 8.6 (19T572)
Release Type:        User
Report Version:      104

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000000000defe
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL 5 Trace/BPT trap: 5
Terminating Process: exc handler [2875]

Triggered by Thread:  0

Application Specific Information:
sigaction on fatal signals is not supported

Thread 0 name:   Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_c.dylib                       0x403ede2d sigaction.cold.1 + 17
1   libsystem_c.dylib                       0x403a44f5 rand_r + 1
2   watchos-app Extension                     0x389f07 installSignalHandler + 181
3   watchos-app Extension                     0x389dd5 setEnabled + 91
4   watchos-app Extension                     0x387969 setMonitorEnabled + 57
5   watchos-app Extension                     0x3878ef sentrycrashcm_setActiveMonitors + 185
6   watchos-app Extension                     0x38e63f sentrycrash_setMonitoring + 47
7   watchos-app Extension                     0x38e4cd sentrycrash_install + 357
8   watchos-app Extension                     0x38d013 -[SentryCrash install] + 153
9   watchos-app Extension                     0x387395 -[SentryCrashInstallation install] + 149
10  watchos-app Extension                     0x3455c9 __43-[SentryCrashIntegration startCrashHandler]_block_invoke + 393
11  libdispatch.dylib                       0x44e08377 _dispatch_client_callout + 7
12  libdispatch.dylib                       0x44e0946b _dispatch_once_callout + 15
13  watchos-app Extension                     0x350f09 -[SentryDispatchQueueWrapper dispatchOnce:block:] + 69
14  watchos-app Extension                     0x345427 -[SentryCrashIntegration startCrashHandler] + 159
15  watchos-app Extension                     0x3452eb -[SentryCrashIntegration installWithOptions:] + 535
16  watchos-app Extension                     0x37069b +[SentrySDK installIntegrations] + 961
17  watchos-app Extension                     0x36f0b3 +[SentrySDK startWithOptionsObject:] + 523
18  watchos-app Extension                     0x36f145 +[SentrySDK startWithConfigureOptions:] + 127
19  watchos-app Extension                      0xb8295 ExtensionDelegate.applicationDidFinishLaunching() + 389

To me, this indicates that signal stuff is still not working the way Sentry expects it to on watchOS...

philipphofmann commented 2 years ago

@armcknight, do you maybe have any clue what we would roughly need to do to make this happen?

armcknight commented 2 years ago

So, this is something that we researched at Crashlytics while I was there, soon after the original announcement and release of watchOS. Unfortunately, some of the fundamental APIs needed to record mach exceptions and signals are explicitly disallowed in watchOS. See:

This basically precludes any notification of a crash having occurred, or being able to capture sensical results at such a time.

It appears Crashlytics actually went ahead anyways and tried adding watchOS crash reporting (as mentioned by @philipphofmann upthread) a couple months after this issue was opened, without success.

philipphofmann commented 2 years ago

Thanks for the update, @armcknight.

djavan-bertrand commented 1 year ago

Hello @philipphofmann, since you mentioned that the number of people interested in that topic might change its priority, here is a message to tell you that it does really matter for us to get the crashes on watchos πŸ˜„ I really hope you can manage to add the support of crash handling on watchos. Thanks in advance.

philipphofmann commented 1 year ago

Please upvote at the top of the issue @djavan-bertrand. I can't give you an ETA yet.

brustolin commented 1 year ago

We can't do anything about this until Apple enables signal handling, and Mach exception support for WatchOS.

f you want this, you need to go to Apple developer forum and let them know you would like Mach exception support and Signal handling support for WatchOS.

philipphofmann commented 1 year ago

As mentioned in https://github.com/getsentry/sentry-cocoa/issues/406#issuecomment-1171872518, fundamental APIs needed to record mach exceptions and signals are explicitly disallowed in watchOS. So we can only provide a proper user experience once Apple enables signal handling, mach exception support for watchOS. Therefore, we close this issue.

Supporting unhandled exceptions should be possible, though, and we opened a new issue for that: https://github.com/getsentry/sentry-cocoa/issues/2747.

triplef commented 1 year ago

I would encourage everyone to use Feedback Assistant to request these missing APIs required for 3rd party crash reporting on watchOS from Apple.

That being said getting reporting for unhandled exceptions would be a partial win for us.