Closed derrh closed 4 years ago
Hi @derrh
Thanks for the report. We're just looking in to what could be causing this.
Can you share how you're configuring Bugsnag i.e. the full code configuration both in the React Native JS and any iOS native configuration (just strip out your API key)?
Also can you confirm if you've registered any "beforeSend" callbacks to modify the Bugsnag report or have added any additional metadata or breadcrumbs before notifying Bugsnag?
Hello, @mattdyoung, Thanks for the quick reply. We have a very basic config.
const config = new Configuration("<bugsnag api key>")
config.appVersion = version
const errorClient = new Client(config)
We aren't doing anything custom on the native side, and we do not have any beforeSend
callbacks registered.
Ping me if you need any more info on this. I'd be happy to help in any way I can. I have a branch where I can pretty regularly reproduce the freeze if that's helpful, not in code I can share unfortunately, but if additional crash logs or stack traces can help let me know.
@derrh Thanks - we're just trying to see if we can reproduce.
When you say you can regularly reproduce the freeze does that include on an iOS simulator or only on an actual device?
You say the timing of the call to notify
is key. Can you shed any light on what your app might be doing at that point?
@mattdyoung, I don't think we were ever able to reproduce it on the simulator.
In our case it was nearly always freezing when certain images in our app were being rendered. For a while we were trying to determine what was special about these particular images. We knew that removing the images removed the freeze, but we couldn't figure out why. Eventually we realized that the react native Bugsnag thread was stopped in the same place every stack trace.
Something else that may be relevant: It only happens on app launch. It's a few seconds after app launch because several API calls have time to complete and the timing of those API calls was critical to the deadlock (one of those API calls was "notify"-ing), and the others caused the rendering of the images that were acting suspicious. Removing either one of those two actions and the freeze would not happen. In the end we stopped logging that particular error because it was a warning on a benign error that we just wanted to track, but not worth the deadlock of course.
If it would be helpful, I'd be happy to jump on a zoom meeting and step through it for you.
@derrh thank you for the additional information! Can you please write into support@bugsnag.com where we can continue this in more detail and look to set up a zoom meeting if necessary? Thanks!
@mattdyoung @derrh I'm curious if you were able to confirm this issue? I suspect it could be related to similar behavior we're seeing and interested if there's an update. Thanks!
The implementation of AllImages::imageLoadAddressByIndex
is different in the latest version and the last version which the former uses the withReadLock
block to read the _loadedImages
value while the latter doesn’t.
Not sure if this is helpful for your team to investigate. @mattdyoung .
@derrh I guess there was another thread calling a method in AllImages.cpp that uses the withReadLock
block which helped result in a deadlock.
@derrh Ah, I have seen all the 3 links of your crash logs, they just proves my guess that some other thread(s) called the AllImages:xx
method.
@derrh @bigyelow Thanks for the info on this. We believe we've identified the issue and are looking at releasing a fix.
@mattdyoung Does this bug relate to iOS system or logic in Bugsnag itself?
@bigyelow We're still working on the issue so not entirely sure yet what the fix will be but even if it's an iOS issue we may be able to work around it in Bugsnag to prevent it.
Released in v2.23.8.
Description
Notify Bugsnag of an error without a deadlock.
Issue
It's taken quite a bit of sleuthing to come to the conclusion that Bugsnag was causing our app to freeze. It appears to be a race condition with very sensitive timing. All of our crash logs resulting from the deadlock (watchdog on iOS finally killing the app due to the deadlock) include the following stack trace on the React Native Bugsnag thread:
Environment
Library versions:
cocoapods version (if any) (
pod -v
): 1.8.4iOS/Android version(s): iOS 13.3.1 (did not seem to manifest on iOS 12)
simulator/emulator or physical device?: Physical Device (iPhone XS Max, iPhone XS, iPhone 8 and others)
debug mode or production?: Both
[x] (iOS only)
[BugsnagReactNative start]
is present in theapplication:didFinishLaunchingWithOptions:
method in yourAppDelegate
class?[ ] (Android only)
BugsnagReactNative.start(this)
is present in theonCreate
method of yourMainApplication
class?Example code snippet
Here are a few crash logs: https://gist.github.com/derrh/6bfdd0e26647e3812691b52e86d9609a https://gist.github.com/derrh/c20a61d0c596e850d47e5b87b921490a https://gist.github.com/derrh/ee5b91e3ca827d17c1a61044a37d0872
I was not able to reproduce this issue in a minimal scenario due to the challenging timing requirements.