microsoft / plcrashreporter

Reliable, open-source crash reporting for iOS, macOS and tvOS
Other
2.88k stars 537 forks source link

Getting EXC_BAD_ACCESS (code=2) in PLCrashreport.pb-c at Line no. 127 (plcrash__crash_report__unpack) #239

Closed jindalpatel closed 2 years ago

jindalpatel commented 2 years ago

Description

We are using PLCrashreporter to collect crashes. So after our app crash we reopen the app to get the crash logs but We are getting crashes in the loop in PLCrashreport.pb-c at Line no. 127 (plcrash__crash_report__unpack). We have installed PLCrashRepoter using Swift Package.

Details

PLCrashReporter - 1.10.1 iOS 15.5 Xcode 13.4 Language used - Swift We are not using any other third party libraries.

aleksandr-dorofeev commented 2 years ago

Hi @jindalpatel, thanks for contacting us. How do you initialize the library? What signal handler type and symbolication strategy do you use?

jindalpatel commented 2 years ago

Thanks for your reply @aleksandr-dorofeev

I am initializing the library the same way mentioned here.

I simply collect the crash report data into the NSDictionary as key-value pair and then send the data to the server.

Signal handler type : PLCrashReporterSignalHandlerTypeBSD Symbolication strategy : PLCrashReporterSymbolicationStrategyNone

MatkovIvan commented 2 years ago

Hi @jindalpatel, I cannot reproduce this issue, could you please share sample application or that corrupted file with crash report?

PS I'm going to update protobuf-c dependency where the crash happens, but not sure if it helps without local reproduction. SwiftPM can fetch the branch instead of release version, so feel free to try #241

jindalpatel commented 2 years ago

Hi @MatkovIvan Thank you for your reply, I am not able to reproduce the issue all the time, it happened once and was keep crashing the app. So I won't be able to provide the sample application which can produce the crash. Thanks for the release branch link, I will try to use that branch and will update you if I got the crash.

MatkovIvan commented 2 years ago

Closing it for now since I've already updated the dependency where the crash happens. Feel free to reopen this issue if you have more questions or some additional info that can help with investigation. Thanks.

Piyush23786 commented 2 years ago

Hi @MatkovIvan I have identified one scenario which causes an issue If I installed PLCrashreproter through SwiftPackage Manager but if added framework (1.10.2) directly it’s working fine.

MatkovIvan commented 2 years ago

Hi there,

@Piyush23786 thanks for reproduction sample and for confirmation that it's SwiftPM distribution issue.

But we didn't find root cause yet though. We'll let you know when it will be fixed or any other update.

Piyush23786 commented 2 years ago

@MatkovIvan Any update on this?

MatkovIvan commented 2 years ago

@Piyush23786 No, we didn't found the root cause yet. Please use CocoaPods instead of SwiftPM for now

Piyush23786 commented 2 years ago

@MatkovIvan I am not using PLCrashReporter directly. its dependencies for one of the SDK that we are using In our application. CocoaPods is not available for that SDK.

MatkovIvan commented 2 years ago

@jindalpatel are you using Unity in your project too?

It might be a problem with conflict of multiple PLCR versions in the same project. Unity includes PLCR copy with Unity prefix, SwiftPM uses PLCR without any prefix (by SwiftPM system limitation it cannot be changed). The list of prefixed symbols was fixed/updated some time ago - #126, but it looks like Unity uses old version where not all symbols prefixed to prevent conflicts.

@Piyush23786 It's the case for your project for sure - see a lot of warnings like Duplicate symbol '_protobuf_c_message_descriptor_get_field' in: in your build log.

So, it's not a bug in PLCR - please fix duplicating symbols by updating the libraries or by avoiding using multiple copies (with different versions) in the same app. In case of Unity + SwiftPM combination, I don't see simple solution for now. Try to open support ticket on Unity side to update PLCR there and avoid unprefixed symbols in their copy.