ANR at com.unity3d.services.ads.adunit.VideoPlayerHandler.destroy

We had a report come through showing an ANR occurred shortly after the user opened a rewarded ad. See the video here.
The ad appears to show in portrait orientation for a brief moment, then dies (black screen) after rotating to landscape mode.

The stacktrace is seen below:
0 android.media.MediaHTTPConnection.disconnect(MediaHTTPConnection.java:187)
1 android.media.IMediaHTTPConnection$Stub.onTransact(IMediaHTTPConnection.java:132)
2 android.os.Binder.execTransactInternal(Binder.java:1021)
3 android.os.Binder.execTransact(Binder.java:994)
4 android.media.MediaPlayer._release(Native Method)
5 android.media.MediaPlayer.release(MediaPlayer.java:2442)
6 android.widget.VideoView.stopPlayback(VideoView.java:365)
7 com.unity3d.services.ads.adunit.VideoPlayerHandler.destroy(VideoPlayerHandler.java:38)
8 com.unity3d.services.ads.adunit.VideoPlayerHandler.onPause(VideoPlayerHandler.java:74)
9 com.unity3d.services.ads.adunit.AdUnitActivity.onPause(AdUnitActivity.java:219)
10 android.app.Activity.performPause(Activity.java:8184)
11 android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1507)
12 android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:4835)
13 android.app.ActivityThread.performPauseActivity(ActivityThread.java:4796)
14 android.app.ActivityThread.handlePauseActivity(ActivityThread.java:4748)
15 android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:46)
16 android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:181)
17 android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:102)
18 android.app.ActivityThread$H.handleMessage(ActivityThread.java:2239)
19 android.os.Handler.dispatchMessage(Handler.java:107)
20 android.os.Looper.loop(Looper.java:237)
21 android.app.ActivityThread.main(ActivityThread.java:7830)
22 java.lang.reflect.Method.invoke(Native Method)
23 com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
24 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1040)

Callstacks for other threads can be found in the *callstack.txt attachment.

7270054–877714–TOR1GOOGLE-920-VvKKrUm7JRXExejZJR-t-issue-data.txt (1.99 KB)
7270054–877717–TOR1GOOGLE-920-VvKKrUm7JRXExejZJR-t-callstack.txt (138 KB)

I encountered same issue ,did you have any solution ?

Unfortunately we haven’t made any progress on this one, and we can’t reproduce it so I can’t create a bug report. Kinda hoping this thread is seen by someone in the ads department that might be able to help

Same problem here

Hey guys!
I have nearly the same ANR-Message (but with another ad-provider). I try to fix this for nearly 1,5 year now… I had contact with the company and we have eliminated the ANR for 100%, but with ad-revenue-loss of 50-70%… So that was not a solution (they told me, they disabled most of their third-party ad-provider to “fix” the ANR).

Now since nearly a year, they told me they are trying to investigate further…

Let’s try to find possible similarities, since it seems to need some conditions for this ANR:

  • Do you have limited Orientations (“ProjectSettings/Player/Resolution & Presentation/Allowed Orentations…”)?

  • Do you use a “Custom Proguard File”?

  • “ProjectSettings/Player/OtherSettings/ScriptingBackend”

  • Whats your “ProjectSettings/Audio”-values for:

  • “SystemSampleRate”

  • “DSP-Buffer Size”

  • What are the affected android versions of this ANR (if you click on the ANR-Details in the PlayConsole, you can see a bar-diagram for that)

Here are mine:

  • only “Portrait” & “Portrait Upside Down” are allowed
  • Yes, we use a Proguard-File
  • IL2CPP
  • 48000 & "Best Performance
  • its only Android 10 & 11 & 12 (on the time 30.03.22)

If you have any other ideas or questions to find similarities: go ahead :slight_smile:

Almost the same for me:

  1. only “Portrait” & “Portrait Upside Down” are allowed
  2. Yes for Proguard-file
  3. Il2cpp, .NET4.x
  4. Different settings.
  5. Android 11 & 12

I am using Admob mediation and these errors come from Unity Ads SDK for Admob Mediation.

Any news? Have somebody found the issue?

More stack traces:

Binder:16115_5 (native)
tid=182 systid=16876
Root blocking
IO Root blocking
0
libc.so
read
1
libc.so
__sread
2
libc.so
__srefill
3
libc.so
fread_unlocked
4
libc.so
fread
5
libc.so
android_getaddrinfo_proxy
6
libc.so
android_getaddrinfofornetcontext
7
libc.so
android_getaddrinfofornet
8
libjavacore.so
Linux_android_getaddrinfo(_JNIEnv*, _jobject*, _jstring*, _jobject*, int)
libcore.io.Linux.android_getaddrinfo (Native method)
libcore.io.ForwardingOs.android_getaddrinfo (ForwardingOs.java:73)
libcore.io.BlockGuardOs.android_getaddrinfo (BlockGuardOs.java:202)
libcore.io.ForwardingOs.android_getaddrinfo (ForwardingOs.java:73)
java.net.Inet6AddressImpl.lookupHostByName (Inet6AddressImpl.java:135)
java.net.Inet6AddressImpl.lookupAllHostAddr (Inet6AddressImpl.java:103)
java.net.InetAddress.getAllByName (InetAddress.java:1152)
com.android.okhttp.Dns$1.lookup (Dns.java:41)
com.android.okhttp.internal.http.RouteSelector.resetNextInetSocketAddress (RouteSelector.java:178)
com.android.okhttp.internal.http.RouteSelector.nextProxy (RouteSelector.java:144)
com.android.okhttp.internal.http.RouteSelector.next (RouteSelector.java:86)
com.android.okhttp.internal.http.StreamAllocation.findConnection (StreamAllocation.java:176)
com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection (StreamAllocation.java:128)
com.android.okhttp.internal.http.StreamAllocation.newStream (StreamAllocation.java:97)
com.android.okhttp.internal.http.HttpEngine.connect (HttpEngine.java:302)
com.android.okhttp.internal.http.HttpEngine.sendRequest (HttpEngine.java:245)
com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute (HttpURLConnectionImpl.java:465)
com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse (HttpURLConnectionImpl.java:411)
com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode (HttpURLConnectionImpl.java:542)
com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode (DelegatingHttpsURLConnection.java:106)
com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode (HttpsURLConnectionImpl.java:30)
android.media.MediaHTTPConnection.seekTo (MediaHTTPConnection.java:285)
android.media.MediaHTTPConnection.getMIMEType (MediaHTTPConnection.java:465)
android.media.IMediaHTTPConnection$Stub.onTransact (IMediaHTTPConnection.java:159)
android.os.Binder.execTransactInternal (Binder.java:1174)
android.os.Binder.execTransact (Binder.java:1126)

main (blocked)
tid=1 systid=16115 | waiting to lock <0x006b1500> (android.media.MediaHTTPConnection) held by thread 182
Triggered ANR
android.media.MediaHTTPConnection.disconnect (MediaHTTPConnection.java:172)
android.media.IMediaHTTPConnection$Stub.onTransact (IMediaHTTPConnection.java:132)
android.os.Binder.execTransactInternal (Binder.java:1174)
android.os.Binder.execTransact (Binder.java:1126)
android.media.MediaPlayer._release (Native method)
android.media.MediaPlayer.release (MediaPlayer.java:2121)
android.widget.VideoView.stopPlayback (VideoView.java:365)
com.unity3d.services.ads.adunit.VideoPlayerHandler.destroy (VideoPlayerHandler.java:38)
com.unity3d.services.ads.adunit.VideoPlayerHandler.onPause (VideoPlayerHandler.java:74)
com.unity3d.services.ads.adunit.AdUnitActivity.onPause (AdUnitActivity.java:219)
android.app.Activity.performPause (Activity.java:8263)
android.app.Instrumentation.callActivityOnPause (Instrumentation.java:1516)
android.app.ActivityThread.performPauseActivityIfNeeded (ActivityThread.java:5013)
android.app.ActivityThread.performPauseActivity (ActivityThread.java:4974)
android.app.ActivityThread.handlePauseActivity (ActivityThread.java:4925)
android.app.servertransaction.PauseActivityItem.execute (PauseActivityItem.java:46)
android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:176)
android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:2203)
android.os.Handler.dispatchMessage (Handler.java:106)
android.os.Looper.loop (Looper.java:268)
android.app.ActivityThread.main (ActivityThread.java:8019)
java.lang.reflect.Method.invoke (Native method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:627)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:997)

I have basic this same callstack, but with the Android version of IronSource, not Unity. I don’t think this is related to Unity or the Unity plugin for IronSource. But either something in native Android code with IronSource or an Android bug. It does seem to have shown up around Android 10+, so suspect that.

I faced this issue with Admob mediation and with Native Unity Ads. So possibly it connected to the native unity video player code and it is Unity’s issue. I have tried also different unity versions.