Closed Zachary625 closed 2 days ago
IL2CPP
and ARM32
& ARM64
enabledUnity 2018.4.11f1 + Fireabse Unity SDK 9.6.0(.NET 4)
=> FaultyUnity 2018.4.11f1 + Fireabse Unity SDK 9.6.0(.NET 3.5)
=> FaultyUnity 2018.4.11f1 + Fireabse Unity SDK 8.0.0(.NET 3.5)
=> native crashes cannot be recorded, throw and report exceptions are working fineUnity 2022.3.18f1 + Firebase Unity SDK 9.6.0
=> FaultyUnity 2022.3.18f1 + Firebase Unity SDK 11.8.1
using Development Build
=> FaultyUnity 2022.3.18f1 + Firebase Unity SDK 11.8.1
with OpenJDK 17.0.2
, Gradle 8.0
, AGP 8.1.0
, GMS gradle plugin 4.4.1
, crashlytics gradle plugin 3.0.2
=> FaultyUnity 2022.3.18f1 + Firebase Unity SDK 11.8.1
with quick-start-unity/crashlytics/testapp
modified to above test project configuration => Faulty
Fatal Crash
operation are also identical, at least from the first Thread(also anonymous for all threads), pending confirmation for other test projects.Looking forward for replies, thanks.
Hey @Zachary625, thanks for this well detailed report. I've tested with Unity 2022.3.24f1 + Firebase Unity SDK 11.8.1
with the Firebase Unity Quickstart, however I'm not encountering the same issue. Just as a sanity check, could you confirm if you've uploaded the symbols after building the app?
Hi thank you @argzdev, interestingly, uploading the symbols (with Firebase CLI windows-x64) would change the stacktrace to two short lines, sth like this:
Crashed: Thread: SIGSEGV 0x0000000000000001
#00 pc 0xffc724 libil2cpp.so (Marshal.WriteByte [mscorlib__12.cpp]) (BuildId: 5a31f8a7a0115b05bba2704988f06d92e0e8937e)
#01 pc 0x26a7ac libunity.so (Component_Get_Custom_PropGameObject(ScriptingBackendNativeObjectPtrOpaque*)) (BuildId: f78b65a4b65058ee)
#00
being the correct #00
in tomestone and stacktrace, while #01
pc value is never present in the tombstone, seems like uploading the symbol changed the way crashlytics(guessing server) interprets the stacktrace, this is an improvement but I believe it should show up more frames between the two lines, at least my test script should be there and highlighted.
Unity 2018
uses NDK r16b
, only using GCC
, Unity 2022
uses NDK r23b
only supports LLVM
, but AFAIK 11.8.1
still supports Unity 2019
&+, and Unity 2021
using NDK r21d
contains both GCC
and LLVM
toolchain, not sure if this is a promising direction so any explanation and guidance are well appreciated.I'm working on 2 directions:
Unity 2018.4.11f1
and legacy Firebase 8.0.0 (ndk)
as a rollback option, which we were using previously, but seems like neither our project nor the test project is showing native crashes (confirmed managed exceptions can show up almost instantly).
Unity 2022.3.18f1
+ Firebase 11.8.1 NDK
version IL2CPP
reporting nonsense stacktraces, I see there are tomestone files dumped, but a bit searching in firebase sdk source code told me firebase is caching tombstones in fire store? not sure how we can easily inspect the internal details of caching and uploading. I'm using firebase log level verbose and adb shell setprop log.tag.CrashlyticsCore DEBUG
all i see after bootstrap self-inspection logs is:
2024-07-04 22:51:15.711 28559-28612 TRuntime.Cc...ortBackend TEST_APP_ID I Making request to: https://crashlyticsreports-pa.googleapis.com/v1/firelog/legacy/batchlog
// bootstrap self-inspection stuff
2024-07-04 22:51:19.308 28559-28612 TRuntime.Cc...ortBackend TEST_APP_ID I Status Code: 200
2024-07-04 22:51:45.741 28559-28612 TRuntime.Cc...ortBackend TEST_APP_ID I Making request to: https://firebaselogging-pa.googleapis.com/v1/firelog/legacy/batchlog
2024-07-04 22:51:47.161 28559-28612 TRuntime.Cc...ortBackend TEST_APP_ID I Status Code: 200
More details of the build:
Unity 2022.3.18f1 on Win10, export project: checked, build app bundle: unchecked, build system: Gradle, api compat level: .NET standard 2.1 , cpp compiler config: release, target arch: armv7 & arm64, create symbols.zip: debugging, development build: unchecked
.Gradle: 8.0, AGP: 8.1.0, gms plugin: 4.4.1, crashlytics plugin: 3.0.2, build tools version: 33.0.2, compile sdk version: 33, target sdk version: 33, gradle java home: openjdk-17.0.2, use android x: true, enable jetifier: true
Once again thank you for working on this matter!
Good to hear that there's an improvement. There's quite a bit of detail here. I'll try to address some of the provided information:
I believe you should see more frames than just 2 short lines. Here's an example of the stacktrace on my side based on the initial code you've provided:
Crashed: Thread: SIGSEGV 0x0000000000000001
#00 pc 0x7688b9 libil2cpp.so (Marshal.WriteByte [mscorlib__12.cpp]) (BuildId: 065b0b24cb272764c6b528c459294ce81983b740)
#01 pc 0x5a6f3f libunity.so (GUIClipState::Apply(InputEvent&)) (BuildId: be2fca746b83e65c)
#02 pc 0xb13720 libunity.so (__unw_getcontext) (BuildId: be2fca746b83e65c)
#03 pc 0x43d443 libunity.so (scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)) (BuildId: be2fca746b83e65c)
#04 pc 0xb13558 libunity.so (__unw_getcontext) (BuildId: be2fca746b83e65c)
#05 pc 0x44aa3e libunity.so (ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)) (BuildId: be2fca746b83e65c)
#06 pc 0x5a54d7 libunity.so (MonoBehaviourDoGUI(int, ObjectGUIState&, MonoBehaviour::GUILayoutType, int, ScriptingMethodPtr, PPtr<MonoBehaviour>)) (BuildId: be2fca746b83e65c)
#07 pc 0xb309f0 libunity.so (__unw_getcontext) (BuildId: be2fca746b83e65c)
#08 pc 0x5a6f3f libunity.so (GUIClipState::Apply(InputEvent&)) (BuildId: be2fca746b83e65c)
#09 pc 0xa79ec0 libunity.so (__unw_getcontext) (BuildId: be2fca746b83e65c)
#10 pc 0x457614 libunity.so (MonoBehaviour::DoGUI(MonoBehaviour::GUILayoutType, int, int)) (BuildId: be2fca746b83e65c)
....
....
#60 pc 0xca056 libc.so (BuildId: fa337969c798946280caa45e2d71a2e7)
#61 pc 0xcd06b libc.so (BuildId: fa337969c798946280caa45e2d71a2e7)
#62 pc 0xcd030 libc.so (BuildId: fa337969c798946280caa45e2d71a2e7)
#63 pc 0x62d89 libc.so (BuildId: fa337969c798946280caa45e2d71a2e7)
Could you check your Build Settings, if "Debugging" option is selected for the dropdown in the Create symbol.zip. According to the docs, if "Public" option is selected, this will create public symbols that remove more in-depth debug information.
Uneducated guess is that it is because the crashlytics backend detects we're already using 11.8.1, which supports crash-free user sessions that crashlytics promoted as a nice feature and perhaps requires a brand new backend system replacing the old one, thus automatically ignored native crashes from 8.0.0.
IIRC, after installing the updated SDK and uploading symbol information, subsequently-received native crashes should be symbolicated correctly. Previously-received crashes will remain unsymbolicated, as will crashes from older versions of the app that have earlier Firebase Unity versions.
a bit searching in firebase sdk source code told me firebase is caching tombstones in fire store
Crashlytics have its dedicated storage mechanism for logs and crash reports. I'm not aware of it storing in Firestore, any chance you could share where in the source code did you see this?
While I understand there's a lot of gray area that we haven't covered. This article from Unity support might help shed light on certain points.
Let me know if these help.
Thanks @argzdev, this is a quick response, will edit if more details/changes emerge before you reply:
Marshal.WriteByte
, whic I'll be trying too, but the (__unw_getcontext)
is new to me, and perhaps if you could use UGUI to bind a method to a button to reproduce, just for more resemblence? Our bottom line is to get accurate stacktraces, raw is tolerable.
Crashed: Thread: SIGSEGV 0x0000000000000001
#00 pc 0x742fcc libil2cpp.so (__emutls_get_address) (BuildId: f008cccf48b403dbfc3dc556c06e12e3ac32c4cd)
#01 pc 0x742fc8 libil2cpp.so (__emutls_get_address) (BuildId: f008cccf48b403dbfc3dc556c06e12e3ac32c4cd)
still faulty I reckon.
libc.so, libbinder.so, libutils.so, libandroid_runtime.so, libart.so, libandroid.so
all missing build idlibunity.so: UnitySendMessage
and libil2cpp.so: mono_class_get_checked
got symbolicatedunityLibrary/symbols/arm64-v8a & armeabi-v7a/libil2cpp.so & libmain.so & libunity.so
and no zip, I pass this symbols
folder path directly to Firebase CLI to upload, yielding success outputs.
android.buildTypes.release.firebaseCrashlytics.nativeSymbolUploadEnabled true
and use gradlew launcher:assembleRelease launcher:uploadCrashlyticsSymbolFileRelease
, no luck, and use readelf
to check libunity.so
and libil2cpp.so
stripped and symbol elf files and confirm the GNU build id in readelf
output, logcat output, and crashlytics console are all the same(glad to see one thing correct at least).I'm reinstalling Unity 2022 and redownloading Firebase 11.8.1 to get a clean setup, and change version name & code to perhaps force crashlytics to change the BuildId.
Inspired by Crashlytics Troubleshooting I changed C++ Compiler Configuration
from Release
to Debug
in Unity 2022
and Crashlytics native crash stacktrace and symbolication is working (-Wl,--no-rosegment
has no effect). Investigating more.
Thanks for the confirming and adding additional details, @Zachary625.
quickstart-unity/crashlytics/testapp
and added your code:
public void OnCrashClick()
{
DebugLog("+ OnCrashClickMarshal");
Marshal.WriteByte(new IntPtr(1), 1);
DebugLog("- OnCrashClickMarshal");
}
void GUIDisplayControls() { ... if (GUILayout.Button("OnCrashClick")) { OnCrashClick(); } }
> - libc.so, libbinder.so, libutils.so, libandroid_runtime.so, libart.so, libandroid.so all missing build id
I believe this is expected. Stacktraces that are associated with "libc.so" are Android system runtime libraries. Crashlytics is unable to symbolicate those libraries since we don't have visibility into the symbols associated with the system libraries. We're working on making this better in the future but there's no timeline for this.
2. Thanks for confirming this. There's a slight discrepancy in the path for uploading the symbol, according to the [docs](https://firebase.google.com/docs/crashlytics/get-started?platform=unity#build-project-upload-symbols-android), using the path `unityLibrary/symbols` should be enough. However, I don't think this difference should cause any issue as long as all symbols are uploaded.
> are there mechanisms in crashlytics that will drop/ignore old version native crashes if new versions are detected in use, between 8.0.0 and 11.8.1?
3. Crashlytics shouldn't ignore or drop old crashes. It stores the crash reports in the backend infrastructure, so upgrading the SDK version should not affect the data storage. Plus, Crashlytics was made to be backward compatible, so it should still be able to access previously encountered crash reports. Sounds like there could be a problem with the backend.
In summary, I don't think there's any issue with your configuration on the SDK. I believe the issue you're encountering might have something to do with the backend. In this case, could you reach out to our [Firebase support](https://firebase.google.com/support), since we from the SDK team do not have access to your project details. The support team will be able to take a look into your project configuration. Please do share with them this thread, logs, your minimal reproducible example, and any other information you think might be helpful for them.
That said, I'll go ahead and close this thread. Feel free to come back here if you assume that the issue might still be due to the SDK, and we'll reopen this thread right away. Thanks!
Thank you @argzdev !
1.PlayerSettings.SetAdditionalIl2CppArgs("-compiler-flags=\"-fno-omit-frame-pointer\"");
would do the trick. Also curiously Firebase 8.0.0 had no such issue, only 11.8.1 came with this issue, so it might be changes in SDK side?
libil2cpp.sym
to libil2cpp.sym.so
Hi @Zachary625, you could be right regarding the SDK issue. So the reason there was a change in behavior from version 8.0.0
is because starting with Firebase Unity 8.6.1
, Crashlytics will catch and report native IL2CPP crashes for Unity apps. To properly receive native IL2CPP crashes for Unity apps uploading of native library symbol information that is generated at build time is now required.
Now, we might need an in depth analysis of the issue. That said, since we don't have access to project details. Could you file a report to our Firebase support team with the following details:
com.google.firebase:firebase-crashlytics-unity
and com.google.firebase:firebase-crashlytics-ndk
version fields in Assets/Firebase/Editor/CrashlyticsDependencies.xml
.Also please refer them to this discussion thread. Our engineering team will be able to take a look into your project configs.
Thank you @argzdev, so just to confirm I understand correctly, seeing as how we could get native crashes when we were using 8.0.0 and now that we started on 11.8.1 then old 8.0.0 builds cannot receive any native crashes, what you're saying is that if crashlytics (backend?) detects we be using sdk newer than 8.6.1
, it would hide/drop natve crashes sent by older SDKs if no corresponding symbol files that was uploaded? This is indeed a possible explanation and I'll be working on validating this. And perhaps there'd be a release note or doc or sth to backup this hypothesis?
Hi @Zachary625, there might've been some misunderstanding. What I mean is there are some changes with the versions newer than 8.6.1
which leads to missing frames or unsymbolicated stacktrace(which can be fixed by uploading the symbols via CLI). However, this does not explain why older builds cannot receive native crashes. Crashlytics should still receive and show any native crashes of any version including older builds, since it should not have an automatic ignore feature. Which is why I encourage you to submit a report to our Firebase support team, so our engineering team can dig deeper regarding the issue.
Thanks for the clarification! Much obliged!
Description
Overview:
Crashlytics is showing fatal crashes with stacktraces containing always 64 frames, with many stackframes containing pc values that does not make any sense inserted (not sure if they are from other threads), and the stacktrace records are missing thread names.
Motivation for or Use Case
We're using Crashlytics to monitor our app's vitalities and performances, we've just upgraded our Firebase Unity SDK version and after the upgrade the stacktraces of crashes are nearly uncomprehendable, thus blocking our work.
Operating System
Observed on both iOS and Android, after several rounds of inspection on Android I managed to reproduce the issue using a demo Unity + Firebase Crashlytics project, then lead to the hypothesis of Crashlytics issue.
Observations:
An example case crash reproduced by method below resulted in a tombstone like this:
while Crashlytics recorded and reported this:
After merging the tombstone stacktrace into the crashlytics stacktrace, it resulted like this(tabbed lines are from tombstone)
Reproducing the issue
Environment
Unity 2022.3.18f1
withFirebase Crashlytics Unity SDK 11.8.1
using defaultAndroid BoM 32.7.4
, build APK directly withIL2CPP
as scripting backend usingGradle
build system.Implementation
Initializing Firebase
Triggering a crash
Firebase Unity SDK Version
11.8.1
Unity editor version
2022.3.18f1
Installation Method
.unitypackage
Problematic Firebase Component(s)
Crashlytics
Other Firebase Component(s) in use
No response
Additional SDKs you are using
No response
Targeted Platform(s)
Apple Platforms, Android
Unity editor platform
Windows
Scripting Runtime
IL2CPP
Release Distribution Type
Pre-built SDK from https://firebase.google.com/download/unity
Relevant Log Output
No response
If using CocoaPods for Apple platforms, the project's Podfile.lock
Expand
Podfile.lock
snippet```yml 👀 Replace this line with the contents of your Podfile.lock! ```