Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Crash with Exception : java.util.concurrent.TimeoutException

Discussion in 'Editor & General Support' started by samrain_vincell, Sep 5, 2022.

  1. samrain_vincell

    samrain_vincell

    Joined:
    Aug 23, 2022
    Posts:
    19
    Hi,
    I got the following error in my Google Console :

    com.unity3d.player.ReflectionHelper.nativeProxyFinalize
    java.util.concurrent.TimeoutException


    Stack trace
    1
    Type
    Exception java.util.concurrent.TimeoutException
    Exception java.util.concurrent.TimeoutException: com.unity3d.player.ReflectionHelper$1.finalize() timed out after 10 seconds
    at com.unity3d.player.ReflectionHelper.nativeProxyFinalize (ReflectionHelper.java)
    at com.unity3d.player.ReflectionHelper.b (ReflectionHelper.java)
    at com.unity3d.player.ReflectionHelper$1.finalize (ReflectionHelper.java)
    at java.lang.Daemons$FinalizerDaemon.doFinalize (Daemons.java:289)
    at java.lang.Daemons$FinalizerDaemon.runInternal (Daemons.java:276)
    at java.lang.Daemons$Daemon.run (Daemons.java:137)
    at java.lang.Thread.run (Thread.java:929)


    I am using Unity ver : 2020.3.7f1

    I am using the following plugins in my project :

    Facebook 14.1.0
    Flurry 4.0.0
    FireBase 9.3.0
    Google Ads 7.1.0
    AppsFlyer 6.5.4
    IAP 2.0.6
    VoxelBusters 2.2.1
    AWS 3.3.802

    Can someone help me understand and fix this error?

    Thank you!
     
    chong_unity837 and AdrianMesa like this.
  2. AdrianMesa

    AdrianMesa

    Joined:
    Oct 8, 2021
    Posts:
    10
    We are having the same issue with 2021.3.7f1
    We still don't have any idea about what is causing it.
    We suspect that is happening when the app goes to background.
    Another related post
     
  3. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,710
    This is an unfortunate race condition between Unity shutting down and and Java garbage collection happening at the same time.
    Please report a bug and do link this thread in the report!
    We do disable all proxies on background so that Java does not call into C# that is gone, but we have a race condition here.
     
  4. AdrianMesa

    AdrianMesa

    Joined:
    Oct 8, 2021
    Posts:
    10
  5. chong_unity837

    chong_unity837

    Joined:
    Sep 13, 2022
    Posts:
    2
    The same thing happened, is there any way to fix the error?
     
  6. samrain_vincell

    samrain_vincell

    Joined:
    Aug 23, 2022
    Posts:
    19
    Hi @AdrianMesa ,
    Thanks for creating a bug ticket, but I don't have permission to access the portal that the ticket is in. I created an account with Unity3d - Altassian, but I guess I need some kind of authorization to view the ticket and the progress in it. Can you please either make the ticket public or give me access. I created the original post of this page. My email address is :
    sameer.raina@vincellstudios.com
    Thank you!
     
  7. jose_unity422

    jose_unity422

    Joined:
    Sep 15, 2022
    Posts:
    1
    Hey @AdrianMesa , thank you for creating the ticket, but same as reported by @samrain_vincell I am also having trouble getting into the portal. If you could add me as well as I really need to get this solved asap!
    My email is: jj.pc101017@gmail.com

    Thanks!
     
  8. AdrianMesa

    AdrianMesa

    Joined:
    Oct 8, 2021
    Posts:
    10
  9. Shefich

    Shefich

    Joined:
    May 23, 2013
    Posts:
    141
    Is the issue resolved?
     
  10. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,710
    In some versions, with others soon.
    Check the release notes.
     
    NikitaLikhoded likes this.
  11. Joseguepardo

    Joseguepardo

    Joined:
    Mar 3, 2015
    Posts:
    8
    Hey Aurimas, would you be so kind to point out some of the versions that have the issue resolved? I'm having trouble finding one. I'm currently on 2021.3.11f1 but the issue seems to still be present on that one.
     
    NikitaLikhoded likes this.
  12. chong_unity837

    chong_unity837

    Joined:
    Sep 13, 2022
    Posts:
    2
    Can you point out which version fixed it
     
    NikitaLikhoded likes this.
  13. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    75
    @Aurimas-Cernius Any news on this? I can't find it in the changelog for 2021.3.12f1 (latest LTS)
     
    NikitaLikhoded likes this.
  14. Shefich

    Shefich

    Joined:
    May 23, 2013
    Posts:
    141
    I tried Unity 2020.3.41 and the issue still exist.
    Also I can't see anything similar to this issue in release notes.
    The issue started to appear in my project after I downgraded Unity Advertisment from 4.3.0 to 4.2.1.
     
  15. Shefich

    Shefich

    Joined:
    May 23, 2013
    Posts:
    141
    Unity 2021.3.12 and 2021.3.13 also have these issues.
     
    AdrianMesa likes this.
  16. kolobokspb

    kolobokspb

    Joined:
    Nov 21, 2016
    Posts:
    16
    Unity 2021.3.13f1 problem persists.
     
    AdrianMesa likes this.
  17. domonyiv

    domonyiv

    Joined:
    Oct 1, 2016
    Posts:
    75
  18. AdrianMesa

    AdrianMesa

    Joined:
    Oct 8, 2021
    Posts:
    10
    Hi everyone.
    We updated one game to 2021.3.13f1, and we are still having the issue.

    This is the list of versions I can see in the ticket where the bug is fixed:
    - 2022.1.22f1
    - 2021.3.13f1
    - 2022.2.0b15

    @domonyiv the ticket appear as confirmed in the ticket system I have access.

    @Aurimas-Cernius maybe we can help us here
     

    Attached Files:

    Shefich, kolobokspb and domonyiv like this.
  19. Shefich

    Shefich

    Joined:
    May 23, 2013
    Posts:
    141
    I tried 2021.3.13f and can see too many "Finalize" errors.
     
  20. kolobokspb

    kolobokspb

    Joined:
    Nov 21, 2016
    Posts:
    16
    Unity version : 2021.3.14f1

    Caused by java.util.concurrent.TimeoutException: com.unity3d.player.ReflectionHelper$1.finalize() timed out after 10 seconds
    at com.unity3d.player.ReflectionHelper.nativeProxyFinalize()
    at com.unity3d.player.ReflectionHelper.b()
    at com.unity3d.player.ReflectionHelper$1.finalize:)11)
    at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:289)
    at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:276)
    at java.lang.Daemons$Daemon.run(Daemons.java:137)
    at java.lang.Thread.run(Thread.java:929)
     
    Shefich likes this.
  21. Shefich

    Shefich

    Joined:
    May 23, 2013
    Posts:
    141
  22. jugi_ng

    jugi_ng

    Joined:
    May 13, 2019
    Posts:
    1
    Hey @AdrianMesa

    I also don't have access to Unity Bug reporting system in JIRA. I have new account.

    What I need to do to get access to Bug Reporting system?
     
  23. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,710
    The fix is being worked on.
     
  24. Hasxia

    Hasxia

    Joined:
    Mar 9, 2021
    Posts:
    7
  25. AdrianMesa

    AdrianMesa

    Joined:
    Oct 8, 2021
    Posts:
    10
    Good news, I got notified they reopened the issue.


    The internal verification for *IN-15979: [Android] Crash with Exception : java.util.concurrent.TimeoutException * against ** has failed our internal review.

    The request has been reopened and is awaiting further action.
     
    Hasxia likes this.
  26. DucMTA

    DucMTA

    Joined:
    Jun 18, 2017
    Posts:
    1
    Unity seems to have fixed the bug in 2020.3.42
     

    Attached Files:

    Hasxia likes this.
  27. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,710
    There is another one related to the same thing. Fix is in the pipeline.
     
    Hasxia likes this.
  28. gamedev_co

    gamedev_co

    Joined:
    Apr 16, 2021
    Posts:
    5
    Any update on that? Bacause it still exists in Unity 2021.3.18f1
     
  29. andreyul

    andreyul

    Joined:
    Nov 25, 2014
    Posts:
    2
    This is our top crash reported by Google Play Console. 9 out of 10 reports of a timeout exception indicate that one of our threads is stuck calling AndroidJavaProxy method.
    This exception is not related to an app shutdown. The crash happens only on Huawei devices. ANR helper thread from an AppCenter crash report indicates that:

    1) the Android activity is in a resumed (not paused or stopped) state when the crash is triggered;
    com.example.app.ANRDebug$Activity.resumed(ANRDebug.java:128)
    // Android activity is in a resumed state

    2) the app has been started less that a minute ago.
    com.example.app.ANRDebug$Elapsed.second1(ANRDebug.java:172)
    // less that 30 seconds since the app start

    Code (CSharp):
    1. com.unity3d.player.ReflectionHelper.nativeProxyInvoke
    2. com.unity3d.player.ReflectionHelper.a
    3. com.unity3d.player.ReflectionHelper$1.invoke
    4. java.lang.reflect.Proxy.invoke(Proxy.java:1006)
    5. $Proxy13.OnConnected  // AndroidJavaProxy method
    6. com.example.androidlibs.googleplayservices.examplePlayGamesService.raiseConnectedThread(examplePlayGamesService.java:448)
    7. com.example.androidlibs.googleplayservices.examplePlayGamesService.access$1000(examplePlayGamesService.java:39)
    8. com.example.androidlibs.googleplayservices.examplePlayGamesService$9.run(examplePlayGamesService.java:408)
    9. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    10. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    11. java.lang.Thread.run(Thread.java:923)
    Code (CSharp):
    1. java.util.concurrent.TimeoutException: com.unity3d.player.ReflectionHelper$1.finalize() timed out after 10 seconds
    2. at com.unity3d.player.ReflectionHelper.nativeProxyFinalize(Unknown Source:-2)
    3. at com.unity3d.player.ReflectionHelper.b(Unknown Source)
    4. at com.unity3d.player.ReflectionHelper$1.finalize(Unknown Source:11)
    5. at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:291)
    6. at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:278)
    7. at java.lang.Daemons$Daemon.run(Daemons.java:139)
    8. at java.lang.Thread.run(Thread.java:923)
     
    Last edited: Feb 20, 2023
    melih_unity222, bpicard and XMnt like this.
  30. Hasxia

    Hasxia

    Joined:
    Mar 9, 2021
    Posts:
    7
    Any update?
     
  31. melih_unity222

    melih_unity222

    Joined:
    Sep 7, 2020
    Posts:
    1
    Have been waiting updates on this as well, the issue persists in Unity 2021.3.17

    We have the similar analytics that 99% of the cases happen on Huawei devices

    Code (CSharp):
    1. Caused by java.util.concurrent.TimeoutException: com.unity3d.player.ReflectionHelper$1.finalize() timed out after 10 seconds
    2.        at com.unity3d.player.ReflectionHelper.nativeProxyFinalize()
    3.        at com.unity3d.player.ReflectionHelper.b()
    4.        at com.unity3d.player.ReflectionHelper$1.finalize(:11)
    5.        at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:289)
    6.        at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:276)
    7.        at java.lang.Daemons$Daemon.run(Daemons.java:137)
    8.        at java.lang.Thread.run(Thread.java:929)
     
    fazli_unity, alperki and serhad_unity like this.
  32. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,710
    Try Unity 2021.3.19, there was a fix that might be related to it.
     
  33. XMnt

    XMnt

    Joined:
    Feb 20, 2018
    Posts:
    3
    We have the same top crash reported by Google Play Console. We are using Unity 2020.3.38f

    Code (CSharp):
    1. Exception java.util.concurrent.TimeoutException: com.unity3d.player.ReflectionHelper$1.finalize() timed out after 10 seconds
    2.   at com.unity3d.player.ReflectionHelper.nativeProxyFinalize
    3.   at com.unity3d.player.ReflectionHelper.b
    4.   at com.unity3d.player.ReflectionHelper$1.finalize
    5.   at java.lang.Daemons$FinalizerDaemon.doFinalize (Daemons.java:289)
    6.   at java.lang.Daemons$FinalizerDaemon.runInternal (Daemons.java:276)
    7.   at java.lang.Daemons$Daemon.run (Daemons.java:137)
    8.   at java.lang.Thread.run (Thread.java:929)
    It happens in the first 10 seconds of application start and affects only Huawei devices
    upload_2023-5-12_8-51-29.png

    This crash affects all our projects. We can reproduce this crash with this simple steps (on a Huawei device):
    1. Start the app
    2. Exit the app
    3. Repeat
    It occurs approximately in 1 out of 10 starts. After some research and patching of ReflectionHelper class we think that this crash caused by a deadlock in an internal JNI code. And we found that the frequency of this crash decreases significantly if we build our project with Android Studio using Export Project in Unity.

    Our crash rate for Huawei devices (the big drop is when an Android Studio build was released):
    upload_2023-5-12_9-31-56.png
    But the crash rate is still too high and we are waiting for a Unity fix
     
  34. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,710
    Upgrade to 2020.3.46f1 or later.
     
  35. krishna_vincellstudios

    krishna_vincellstudios

    Joined:
    Oct 19, 2020
    Posts:
    6
    Is this issue fixed in Unity 2021.3.19?
     
    kolobokspb likes this.
  36. joker_yash96

    joker_yash96

    Joined:
    May 9, 2019
    Posts:
    7
    Facing the Issue in Unity 2021.3.22f1.
    Any Update ?
     
  37. XMnt

    XMnt

    Joined:
    Feb 20, 2018
    Posts:
    3
    We finally found the cause of the crashes on huawei devices. Updating to Unity 2020.3.46f1 or Unity 2021.3.19 or later did not resolve the issue in our case. Crashes disappeared but the application started to freeze at the same time it crashed before. We took a dump and realised that the main reason of freezes is Incremental GC. We disabled it in the project settings and the problem disappeared
     
    Petr777 likes this.
  38. vshliakhovchuk

    vshliakhovchuk

    Joined:
    Dec 2, 2022
    Posts:
    1
    @AdrianMesa Could, @Aurimas-Cernius are there any news on this? Can you please check the status of the ticket? I can't access the portal.
     
  39. kahyong_unity

    kahyong_unity

    Unity Technologies

    Joined:
    Jan 17, 2019
    Posts:
    5
    Hi all, the issue has been fixed (or at least the bug report has been), and here is a summary of all the Unity versions that the fix has landed on:

    Branch:2020.3.X
    Resolution: Fixed
    Fix Versions: 2020.3.46f1
    Resolution Notes:

    Branch:2021.3.X
    Resolution: Fixed
    Fix Versions: 2021.3.19f1
    Resolution Notes:

    Branch:2023.1.X
    Resolution: Fixed
    Fix Versions: 2023.1.0b3
    Resolution Notes:

    Branch:2022.1.X
    Resolution: Fixed
    Fix Versions: 2022.1.22f1
    Resolution Notes:

    Branch:2022.2.X
    Resolution: Fixed
    Fix Versions: 2022.2.4f1
    Resolution Notes:

    Branch:2023.2.X
    Resolution: Fixed
    Fix Versions: 2023.2.0a1
    Resolution Notes:

    If you still have issues after upgrading, please raise a new bug report with us using the reproduction project so that we can look into it further. It might be a different issue.
     
  40. ZhenglangTech

    ZhenglangTech

    Joined:
    Dec 21, 2018
    Posts:
    7
    Hi guys,

    We are using Unity 2021.3.15. And this issue is the top 1 crash case which takes about 20% of total crash events in our game.
    @samrain_vincell
    Did you upgrade Unity to the version which mentioned by @kahyong_unity? Is the issue fixed?

    Thank you very much for your reply!
     
    Petr777 likes this.