Lots of ANRs (Broadcast of Intent { act=android.intent.action.SCREEN_OFF flg=0x58200010 })

Our ANR rate is abysmal - at 0.92% vs the threshold of 0.47%. Looking into it, we see a lot of the above trace. 

Here is a trace that I was able to capture. While many of the threads seems to relate to Adjust, when we pinged adjust, they aren’t so sure it’s related to them SDK. We are using Corona 2019.3549 (2019.11.9). 

https://pastebin.com/HnwAC1rY

We can really use some help! 

FYI - I am opening a new thread from this other thread because that one was more crashes, this is ANR. Not sure if related

https://forums.coronalabs.com/topic/77022-lots-of-crashes-due-to-comnaefjnalua/#entry406284

Please also see the discussions happening here on the Adjust SDK Git: 

https://github.com/adjust/corona_sdk/issues/13#issuecomment-586516033

They seem to think that the issue is with Corona. We are at a loss. @vlad can you help? 

Thx!

So I don’t believe yours has anything to do with Adjust. It looks like an issue of playing music while the game is being pushed to the background. My suggestion is to try to stop the music when the game goes to the background. This is mostly a guess by looking at your trace logs.

Thx @agramonte… So maybe try to pause the audio when the app goes into the background? 

yes. that would be my suggestion.

@agramonte do you solve this problem?

Not all ANRS even with the same grouping are the same. You have to look at the trace and determine the cause. In my case (since I don’t use adjust) most of them were:

  1. OpenSSL connection while the phone was going on the background.
  • I tried to batch together and not do them as often and cancel them when the device goes into the background.
  1. Playing a sound or music while the phone was going to the background.

         - Removed the music and tried to clean up sounds before going into the background.

So far this has resulted in me being just under the threshold. So not resolved, but not in the red.

Please also see the discussions happening here on the Adjust SDK Git: 

https://github.com/adjust/corona_sdk/issues/13#issuecomment-586516033

They seem to think that the issue is with Corona. We are at a loss. @vlad can you help? 

Thx!

So I don’t believe yours has anything to do with Adjust. It looks like an issue of playing music while the game is being pushed to the background. My suggestion is to try to stop the music when the game goes to the background. This is mostly a guess by looking at your trace logs.

Thx @agramonte… So maybe try to pause the audio when the app goes into the background? 

yes. that would be my suggestion.

@agramonte do you solve this problem?

Not all ANRS even with the same grouping are the same. You have to look at the trace and determine the cause. In my case (since I don’t use adjust) most of them were:

  1. OpenSSL connection while the phone was going on the background.
  • I tried to batch together and not do them as often and cancel them when the device goes into the background.
  1. Playing a sound or music while the phone was going to the background.

         - Removed the music and tried to clean up sounds before going into the background.

So far this has resulted in me being just under the threshold. So not resolved, but not in the red.

Exactly the same problem, the share of ANR errors is already more than 1.92% Has anyone solved this problem?

Broadcast of Intent { act=android.intent.action.SCREEN_OFF flg=0x50200010 }, VisibleToUser

Broadcast of Intent { act=android.intent.action.SCREEN_ON flg=0x50000010 }

We have the same problem. We’ve tried reducing the amount of work that happens on suspend/exit considerably, and also paused sounds when the app is backgrounded but it’s made little difference.

In our case almost all ANR stack traces end up here:

at com.ansca.corona.Controller.stop (Controller.java)
at com.ansca.corona.CoronaActivity.requestSuspendCoronaRuntime (CoronaActivity.java:2054)
at com.ansca.corona.CoronaActivity.onPause (CoronaActivity.java:1877) 

Out of curiosity, which ad networks do the people here use? I assume you’re still using ironSource @agramonte? The reason I ask is because I’m wondering whether the issue could be caused by an ad network pausing the main activity while the ad activity is in the foreground. If the ad then failed to render correctly, that could cause the app to remain in a ‘not responding’ state. It’s just a hypothesis at the moment though.

I use ironsource but not all the adapters. Only the adapters approved by google for underage. The other ones, I just keep updating for you.

["plugin_ironsource"] = 
        {
            publisherId = "com.cabagomez"
        },
        ["plugin_isunity"] = 
        {
            publisherId = "com.cabagomez"
        },
        ["plugin_isadcolony"] = 
        {
            publisherId = "com.cabagomez"
        },
        ["plugin_isapplovin"] = 
        {
            publisherId = "com.cabagomez"
        },
        ["plugin_ischartboost"] = 
        {
            publisherId = "com.cabagomez"
        },
        ["plugin_isadmob"] = 
        {
            publisherId = "com.cabagomez"
        }, 
        ["plugin_isvungle"] = 
        {
            publisherId = "com.cabagomez"
        },
        ["plugin_isinmobi"] =
        {
            publisherId = "com.cabagomez"
        },