Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Crash [libFirebaseCppApp-12_0_0.so] firebase::Mutex::Acquire() #1030

Closed
SachinTichkule opened this issue May 20, 2024 · 6 comments
Closed
Labels
api: messaging needs-attention Need Googler's attention

Comments

@SachinTichkule
Copy link

Description

Unity version 2023.2.16f1
IL2CPP .net standard 2.1
c++ configuration master
incremental GC disable
Target architecture armv7, arm64
enable armv9 secuirty features for arm64

Reproducing the issue

Playstore Crash and ANR Report

Firebase Unity SDK Version

12.0.0

Unity editor version

2023.2.16f1

Installation Method

.unitypackage

Problematic Firebase Component(s)

Messaging

Other Firebase Component(s) in use

Messaging

Additional SDKs you are using

Facebook, In app review, In app update

Targeted Platform(s)

Android

Unity editor platform

Windows

Scripting Runtime

IL2CPP

Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

Relevant Log Output

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 3811 >>> com.Tambola.Tambola <<<

backtrace:
  #00  pc 0x00000000000fcbb8  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock+8)
  #01  pc 0x00000000001a12e0  /data/app/~~nqBsUCaydB2EwNiYOvnMVw==/com.Tambola.Tambola-YId45jo8vwpaztmk2YyKLg==/lib/arm64/libFirebaseCppApp-12_0_0.so (firebase::Mutex::Acquire()+8)
  #02  pc 0x000000000024d570  /data/app/~~nqBsUCaydB2EwNiYOvnMVw==/com.Tambola.Tambola-YId45jo8vwpaztmk2YyKLg==/lib/arm64/libFirebaseCppApp-12_0_0.so (void firebase::ReferenceCountedFutureImpl::CompleteInternal<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, void firebase::ReferenceCountedFutureImpl::CompleteWithResultInternal<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >(firebase::FutureHandle const&, int, char const*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)::'lambda'(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*)>(firebase::FutureHandle const&, int, char const*, void firebase::ReferenceCountedFutureImpl::CompleteWithResultInternal<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >(firebase::FutureHandle const&, int, char const*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)::'lambda'(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*) const&)+52)
  #03  pc 0x00000000002d2f28  /data/app/~~nqBsUCaydB2EwNiYOvnMVw==/com.Tambola.Tambola-YId45jo8vwpaztmk2YyKLg==/lib/arm64/libFirebaseCppApp-12_0_0.so (firebase::messaging::CompleteStringCallback(_JNIEnv*, _jobject*, firebase::util::FutureResult, char const*, void*)+352)
  #04  pc 0x00000000001967e0  /data/app/~~nqBsUCaydB2EwNiYOvnMVw==/com.Tambola.Tambola-YId45jo8vwpaztmk2YyKLg==/lib/arm64/libFirebaseCppApp-12_0_0.so (firebase::util::JniResultCallback_nativeOnResult(_JNIEnv*, _jobject*, _jobject*, unsigned char, unsigned char, _jstring*, long, long)+232)
  #05  pc 0x0000000000351e30  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144)
  #06  pc 0x00000000005ba6ac  /apex/com.android.art/lib64/libart.so (nterp_helper+7468)
  #07  pc 0x0000000000000db0  /data/data/com.Tambola.Tambola/cache/oat/arm64/app_resources_lib.vdex (com.google.firebase.app.internal.cpp.JniResultCallback.onCompletion+32)
  #08  pc 0x00000000005b98d4  /apex/com.android.art/lib64/libart.so (nterp_helper+3924)
  #09  pc 0x0000000000000c24  /data/data/com.Tambola.Tambola/cache/oat/arm64/app_resources_lib.vdex (com.google.firebase.app.internal.cpp.JniResultCallback$TaskCallback.onSuccess+32)
  #10  pc 0x00000000005ba6f4  /apex/com.android.art/lib64/libart.so (nterp_helper+7540)
  #11  pc 0x0000000000200402  /data/app/~~nqBsUCaydB2EwNiYOvnMVw==/com.Tambola.Tambola-YId45jo8vwpaztmk2YyKLg==/oat/arm64/base.vdex (com.google.android.gms.tasks.zzm.run+50)
  #12  pc 0x0000000000add3cc  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Handler.dispatchMessage+76)
  #13  pc 0x0000000000ae11c8  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Looper.loopOnce+1048)
  #14  pc 0x0000000000ae0cfc  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Looper.loop+1132)
  #15  pc 0x000000000087fe24  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.app.ActivityThread.main+1748)
  #16  pc 0x000000000033b680  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640)
  #17  pc 0x000000000037cb18  /apex/com.android.art/lib64/libart.so (_jobject* art::InvokeMethod<(art::PointerSize)8>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1556)
  #18  pc 0x000000000037c4f4  /apex/com.android.art/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*) (.__uniq.165753521025965369065708152063621506277)+32)
  #19  pc 0x00000000003995f8  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+120)
  #20  pc 0x0000000000e08548  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+136)
  #21  pc 0x0000000000e14428  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (com.android.internal.os.ZygoteInit.main+3672)
  #22  pc 0x000000000033b680  /apex/com.android.art/lib64/libart.so (art_quick_invoke_static_stub+640)
  #23  pc 0x00000000004e2a90  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+728)
  #24  pc 0x000000000057ab18  /apex/com.android.art/lib64/libart.so (art::JNI<true>::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+156)
  #25  pc 0x00000000000bfce8  /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+120)
  #26  pc 0x00000000000cbcf8  /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+1016)
  #27  pc 0x0000000000002560  /system/bin/app_process64 (main+1280)
  #28  pc 0x00000000000851c0  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+96)

If using CocoaPods for Apple platforms, the project's Podfile.lock

Expand Podfile.lock snippet
👀 Replace this line with the contents of your Podfile.lock!
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@SachinTichkule SachinTichkule changed the title Crash [libFirebaseCppApp-12_0_0.so] firebase::Mutex::Acquire() [Bug] Crash [libFirebaseCppApp-12_0_0.so] firebase::Mutex::Acquire() May 20, 2024
@argzdev argzdev added api: messaging and removed needs-triage new New issue. labels May 20, 2024
@argzdev
Copy link

argzdev commented May 20, 2024

Hey @SachinTichkule, thanks for reaching out. Could you answer a few questions below for us to investigate this behavior:

  1. Did you experience this issue from the previous versions of the SDK?
  2. Could you share code snippets of your usage of Firebase Messaging?
  3. Are you able to reproduce the issue? If so, any chance you could share a minimal reproducible example? It'll help speed up our investigation and resolution for this issue.

Thanks!

@argzdev argzdev added the needs-info Need information for the developer label May 20, 2024
@SachinTichkule
Copy link
Author

using Unity.Notifications.Android;
using UnityEngine;
using UnityEngine.Android;

public class Notification : MonoBehaviour
{
public static string Token { get; private set; }
AndroidNotification notification = new AndroidNotification();
AndroidNotificationChannel channel;
void Start()
{
AndroidNotificationCenter.CancelAllNotifications();
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
{
var dependencyStatus = task.Result;
if (dependencyStatus == Firebase.DependencyStatus.Available)
{
var firebase = Firebase.FirebaseApp.DefaultInstance;
InitFireBase();
}
else
{
Logger.ShowError(System.String.Format(
"Could not resolve all Firebase dependencies: {0}", dependencyStatus));
}
});
CreateNotificationChannel();
AskNotificationPermission();
}
async void InitFireBase()
{
Firebase.Messaging.FirebaseMessaging.MessageReceived += OnMessageReceived;
Token = await Firebase.Messaging.FirebaseMessaging.GetTokenAsync();
if(!string.Equals("StubToken",Token))
Logger.ShowMessage(Token);
}
public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
{
Logger.ShowMessage("Received a new message from: " + e.Message.Data);
if (!e.Message.NotificationOpened)
if (e.Message.Notification != null)
SendNotification(e.Message.Notification);
}
void AskNotificationPermission()
{
if (!Permission.HasUserAuthorizedPermission("android.permission.POST_NOTIFICATIONS"))
{
Permission.RequestUserPermission("android.permission.POST_NOTIFICATIONS");
}
}
void CreateNotificationChannel()
{
channel = new AndroidNotificationChannel()
{
Id = "channel_id",
Name = "Default Channel",
Importance = Importance.Default,
Description = "Tambola Game",
};
AndroidNotificationCenter.RegisterNotificationChannel(channel);

}
void SendNotification(Firebase.Messaging.FirebaseNotification noti)
{
try
{
notification.Title = noti.Title;
notification.Text = noti.Body;
notification.FireTime = System.DateTime.Now;
notification.SmallIcon = "small";
notification.LargeIcon = "large";

     AndroidNotificationCenter.SendNotification(notification, channel.Id);
  }
  catch (System.Exception e)
  {
     Logger.ShowCatchError(e.Message);
  }

}
void CancelNotification()
{
AndroidNotificationIntentData data = AndroidNotificationCenter.GetLastNotificationIntent();
if (data != null)
AndroidNotificationCenter.CancelNotification(data.Id);
}

private void OnApplicationFocus(bool focus)
{
if (focus)
{
CancelNotification();
}
}
}

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels May 20, 2024
@SachinTichkule
Copy link
Author

SachinTichkule commented May 21, 2024

@argzdev I did not how to produce but it shows in google play store ANR and crash report, yes it shows in every sdk version of firebase which i used

@abogarsukov-braingames
Copy link

abogarsukov-braingames commented Jun 5, 2024

This happens for all our app as well. Firebase v11.6 and v11.9.

@a-maurice
Copy link
Collaborator

The latest release, 12.1.0, https://github.com/firebase/firebase-unity-sdk/releases/tag/v12.1.0, has a potential fix for this issue. Since we weren't able to reproduce this though, this is just based on the call stack. But will close this issue for now, if you still see problems, please let us know.

@firebase firebase locked and limited conversation to collaborators Jul 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: messaging needs-attention Need Googler's attention
Projects
None yet
Development

No branches or pull requests

5 participants