protocolbuffers / protobuf

Protocol Buffers - Google's data interchange format
http://protobuf.dev
Other
65.49k stars 15.46k forks source link

iOS SDK 3.3.0 GPBRefreshBuffer EXC_SOFTWARE / UNCAUGHT_NS_EXCEPTION on GPBCodedOutputStream.m #3267

Closed keremerkan closed 6 years ago

keremerkan commented 7 years ago

I am using Protobuf as a dependency on my app for Firebase Crash Reporting / Firebase Performance. After updating to iOS Protobuf 3.3.0 via Cocoapods, I started getting uncaught exceptions on GPBCodedOutputStream.m:68

I immediately downgraded to version 3.2.1 and the crashes are gone.

I can provide crash reports for more information.

thomasvl commented 7 years ago

Without more info, it is hard to say where the problem is, it could be something firebase is doing and not a problem within the protobuf library. If you can make a simple sample project that reproduces the problem, we can help figure out where the problem is.

keremerkan commented 7 years ago

Unfortunately I cannot reproduce the issue too. I can provide stack traces from Apple and Firebase if that would help.

thomasvl commented 7 years ago

For lack of anything better, that might help. If you haven't already, you might want to open an issue against Firebase incase it is in their code, they might already know and if not, they could also try to help figure out the root cause.

keremerkan commented 7 years ago

Here is the stack trace. It is always the same, and it is always because of -[CCTLogOutputStream writeLogEvent:]. After that, GPBRefreshBuffer class raises the exception. The same code works or seems to work without any exceptions when Protobuf is version 3.2.1. Maybe it silently ignores the error on that version, or there is some other problem, but the stack trace is always the same. I could not find where CCTLogOutputStream class is used, but Protobuf is a dependency only for Firebase Crash reporting and Firebase Performance, so I suspect it comes from one of them.

Hope this helps.

1 CoreFoundation __exceptionPreprocess + 1022235
2 libobjc.A.dylib objc_exception_throw + 28181
3 CoreFoundation +[NSException raise:format:] + 1022047
4 MyApp GPBRefreshBuffer (GPBCodedOutputStream.m:68)
5 MyApp -[CCTLogOutputStream writeLogEvent:] + 6506461
6 MyApp __72-[CCTLogWriter writeLog:pseudonymousID:directory:clock:logTransformers:]_block_invoke + 6500009
7 libdispatch.dylib _dispatch_call_block_and_release + 10273
8 libdispatch.dylib _dispatch_queue_drain$VARIANT$mp + 62497
9 libdispatch.dylib _dispatch_queue_invoke$VARIANT$mp + 59999
10 libdispatch.dylib _dispatch_root_queue_drain + 71143
11 libdispatch.dylib _dispatch_worker_thread3 + 69579
12 libsystem_pthread.dylib _pthread_wqthread + 6951
13 libsystem_pthread.dylib start_wqthread + 5910
thomasvl commented 7 years ago

fyi - reached out to the Firebase team within Google to see about them updating their code to handle the possible fail case.

eshiehz commented 7 years ago

keremerkan@ Can you try with the recently released FirebasePerformance (1.0.3)? It should contain a fix.

keremerkan commented 7 years ago

Sure, I'll see if it will work. I am still not sure how to replicate the crash on my end though.