High ANR rate and poor discoverability

Only released to 1k users but am now getting meaningful crash/ANR data.

So far…

  1. playing an ad leads to an ANR (unity ads)
  2. loading a web page in webView leads to an ANR
  3. weird java out of memory errors when bugsnag shows plenty of free memory

much work to be done to solar it seems…

Do we need a repository for all the reports so they have visibility and can be marked (and tested by us) as fixed @vlads ?

Have you guys sat down and compared build.settings files or anything? My ANR rate for the past three months is a rock steady 0.28%. My apps don’t have a huge Android install base, but 3,500 daily active users averaging 13,000 play sessions per day isn’t statistically insignificant.

Apologies for sticking my oar in if you’ve already identified the smoking gun, but since this problem is wide-spread but not universal, it would stand to reason that there is something responsible for this issue beyond, “Solar2D has an ANR problem.”

I’d say 0.28% is not 0%.
It could easily get to 0.48% (which is over the threshold), if you just would push more that feature that is already giving you a solid 0.28%.

In fact my first 2 games are still under the threshold, while the last one smashed the bad behaviour point on day 1.

Anyway I surely would give my build settings and console access to anyone who aim to fix this, and I think everyone here would do it…

Basic plugins for ads and notifications definitely appears to exacerbate the issue. Similarly, a gpgs login which invariably logs the user into their account when the app is resumed also seems to cause ANRs.

Trouble is, in development testing, these ANRs are very infrequent and easily overlooked. Most users also simply relaunch the app and get on with it but google have decided to go their own way with this which i frankly a little ridiculous given the tens of thousands different devices that run android

We also now know for a fact that users are able to skip ads easily on Android 11 or higher by minimising the app and brining it back up. This works on some devices ( i could reproduce this on all our Xiaomi devices) but not all and every now and again it leads to an ANR

Apple makes devs jump through hoops but the constant indecisiveness from google is just painful- use GA- now don’t use GA but use firebase. Oh hang on, let’s use GA again. You want alpha testers for your app? Make a Gplus community. But what!! Gplus is winding down. Apple did ATT? Let’s do our own shoddy implementation for it on Android 13 which companies won’t roll out for another decade. Bah!

Sorry about the rant but game dev just keeps getting sillier. More time goes into these shenanigans than making decent games

1 Like

Yeah- I’ve got what amounts to a bunch of paper cuts, and they can add up, but there’s a difference between maybe going from 0.28% to 0.48% and going from 1% to 4% like famousdogg did. That’s not a paper cut, that’s a hemorrhaging wound, so the source should be findable.

I’ll post my plugins below as a control for “not in bad behavior.” Maybe if everyone who’s having a real problem with ANRs notices that they’re all using a plugin that I’m not (Iron Source, Notifications, AdColony which I dumped 18 months ago because of ANRs), that would be a good place to focus engineering resources.

Base plugins (both apps):
plugin.animation
plugin.flurry.analytics
plugin.appsflyer
plugin.google.iap.billing.v2
CoronaProvider.native.popup.social

One app uses:
plugin.admob (w/ com.google.ads.mediation:facebook:6.12.0.0 in the gradle)
plugin.applovin.paid
plugin.chartboost
plugin.unityads.v4

The other one uses:
plugin.applovinMax
plugin.applovinMax.InMobi
plugin.applovinMax.UnityAds
plugin.admob (w/ com.google.ads.mediation:facebook:6.12.0.0 in the gradle)

Out of memory seems to be a big one. No idea how to begin here as I block all devices under 2GB.

Suspend/resume seems to be the main cause based on the traces I have so far.

I am not using bugsnag yet but I recently got a build published into open testing for around 100k users and haven’t seen any ANRs since it went live (only been 48h though)

The only change I’ve made in this build is to wrap my code for cancelling any notifications in pcall. I call this function below from the resume/start system events in all my apps

--call this function from app resume events to cancel all notifications and rest the badge count for ios
function notificationManager.cancelNotificationAndResetBadge()

	local function callThis()
		--cancel all exisiting scheduled notifications if the app is currently running
		notifications.cancelNotification( )
		--for iOS, this will clear the badge count once the app is resume
		native.setProperty( "applicationIconBadgeNumber", 0 )
	end

	pcall(callThis)
end

@anon63346430 can you please say what you’re doing to block out devices with less than 2gb mem? I don’t have the out of memory issues on my apps but I might still consider this as a measure for setting a higher performance threshold for some of our more demanding apps.

Unity ads initialising but not managing to load a ad seems to be a common cause of errors

I’m gonna say this is a unity ads plugin problem…

pcall will only stop lua errors. It will not stop device crashes/ANRs.

You can do this in the console.

Are you calling Unity through plugin.unityads.v4? I just checked my developer console and in the last 28 days I haven’t had a single crash like the one you’re showing. In the same time frame, same app, I’ve served 58,000 Unity ad impressions.

I really don’t have anything to add, but in regards to OutOfMemoryError while creating threads, are there any errors showing a stack size lower 1024KB, or are they all higher than this?

Now I have a few days of meaningful reporting I can summarize 3 main issues.

  1. suspending and/or resuming is causing ANRs

  1. ANRs being caused by memory trimming

  1. unity ads plugin causing ANRs/crashes between init and receiving and init callback

image

I hate to sound like a broken record, but there must be a reason why you’re over the bad behavior threshold and I’m not. My users suspend my apps, and I show Unity ads. There’s a bad actor somewhere.

Without knowing your games this is purely speculation but I would imagine my games push devices far more than yours do. e.g. your apps are probably not trying to restore tens of thousands of textures on resume so you do not see this problem.

Thankfully crashes are not a problem.

Can you add iOS binaries please?

Yes, of course. Will be up hopefully before Monday.

I just pushed a new version of Unity v4 plugin which now uses 4.5

The iOS version is ready. Please thoroughly test. Although I did do testing on three different devices, I don’t have any live apps with this plugin for iOS. In contrast, when I shared the Android versions, thousands of clients were running it.

Great thanks. I’ll test it in a few weeks on an update.