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

SyncTask unregisterReceiver error #6558

Open
white123483 opened this issue Dec 4, 2024 · 3 comments
Open

SyncTask unregisterReceiver error #6558

white123483 opened this issue Dec 4, 2024 · 3 comments

Comments

@white123483
Copy link

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Android Studio Koala | 2024.1.1
  • Firebase Component: Messaging
  • Component version: 24.1.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

I would like to know when com.google.firebase.messaging.SyncTask will be called, because my Google Play console gets task.getContext().unregisterReceiver(this) logging out of the receiver resulting in an error message.

Relevant Code:

// TODO(you): code here to reproduce the problem
Exception java.lang.RuntimeException:
  at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0 (LoadedApk.java:1919)
  at android.app.LoadedApk$ReceiverDispatcher$Args.$r8$lambda$gDuJqgxY6Zb-ifyeubKeivTLAwk (Unknown Source)
  at android.app.LoadedApk$ReceiverDispatcher$Args$$ExternalSyntheticLambda0.run (Unknown Source:2)
  at android.os.Handler.handleCallback (Handler.java:958)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:230)
  at android.os.Looper.loop (Looper.java:319)
  at android.app.ActivityThread.main (ActivityThread.java:8919)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:578)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1103)
Caused by java.lang.IllegalArgumentException:
  at android.app.LoadedApk.forgetReceiverDispatcher (LoadedApk.java:1751)
  at android.app.ContextImpl.unregisterReceiver (ContextImpl.java:1933)
  at android.content.ContextWrapper.unregisterReceiver (ContextWrapper.java:837)
  at com.google.firebase.messaging.SyncTask$ConnectivityChangeReceiver.onReceive (SyncTask.java:194)
  at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0 (LoadedApk.java:1911)
@google-oss-bot
Copy link
Contributor

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@lehcar09
Copy link
Contributor

lehcar09 commented Dec 4, 2024

Hi @white123483 , thank you for reaching out. From what I can gather, the ConnectivityChangeReceiver is a BroadcastReceiver that listens for network connectivity changes. When a connection is established, it triggers a SyncTask to perform a background synchronization. It then unregisters itself after triggering the task to avoid unnecessary resource usage.

I tried reproducing the issue, however, I did not encounter this RuntimeException. I wonder if it is caused by a race condition.

I’ll raise this to our engineers and create a PR for this issue. Thanks!

@white123483
Copy link
Author

你好@white123483,感谢您的联系。据我所知,ConnectivityChangeReceiver 是一个 BroadcastReceiver,用于监听网络连接变化。建立连接后,它会触发 SyncTask 来执行后台同步。触发任务后,它会自行注销,以避免不必要的资源使用。

我尝试重现该问题,但没有遇到此 RuntimeException。我想知道这是否是由竞争条件引起的。

我会向我们的工程师提出这个问题并针对此问题创建 PR。谢谢!

Thank you for your reply! I've tried to reproduce this issue as well, but that didn't work either, so far we only have this error in the Google Play Console crash logs, and more than two hundred users have encountered this issue. So I'm not sure of the exact possible reasons for triggering it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants