media icon indicating copy to clipboard operation
media copied to clipboard

OOM in IMA SDK

Open nishantkp opened this issue 1 year ago • 3 comments

Version

Media3 1.4.1

More version details

No response

Devices that reproduce the issue

The issue is mostly reproducible on GoogleTV devices.

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Did not try

Reproduction steps

When IMA is playing an Ad, the player crashes with OOM error

Expected result

should not throw OOM error while playing ad.

Actual result

stacktrace

Exception java.lang.OutOfMemoryError:
  at java.util.Arrays.copyOf (Arrays.java:3257)
  at java.lang.AbstractStringBuilder.ensureCapacityInternal (AbstractStringBuilder.java:124)
  at java.lang.AbstractStringBuilder.append (AbstractStringBuilder.java:448)
  at java.lang.StringBuilder.append (StringBuilder.java:137)
  at java.lang.StringBuilder.append (StringBuilder.java:132)
  at com.google.ads.interactivemedia.v3.impl.data.zzbn.toString (com.google.ads.interactivemedia.v3:interactivemedia@@3.31.0:6)
  at java.util.Formatter$FormatSpecifier.printString (Formatter.java:2978)
  at java.util.Formatter$FormatSpecifier.print (Formatter.java:2855)
  at java.util.Formatter.format (Formatter.java:2524)
  at java.util.Formatter.format (Formatter.java:2459)
  at java.lang.String.format (String.java:2870)
  at com.google.ads.interactivemedia.v3.impl.JavaScriptMessage.toString (com.google.ads.interactivemedia.v3:interactivemedia@@3.31.0:1)
  at java.lang.String.valueOf (String.java:2924)
  at com.google.ads.interactivemedia.v3.impl.zzbb.zzf (com.google.ads.interactivemedia.v3:interactivemedia@@3.31.0:3)
  at com.google.ads.interactivemedia.v3.impl.zzax.onPostMessage (com.google.ads.interactivemedia.v3:interactivemedia@@3.31.0:2)
  at androidx.webkit.internal.WebMessageListenerAdapter.onPostMessage (WebMessageListenerAdapter.java:55)
  at java.lang.reflect.Method.invoke
  at org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil$InvocationHandlerWithDelegateGetter.invoke (BoundaryInterfaceReflectionUtil.java:162)
  at java.lang.reflect.Proxy.invoke (Proxy.java:1006)
  at $Proxy27.onPostMessage
  at WV.dX.run (chromium-TrichromeWebViewGoogle.aab-stable-661314630:101)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:201)
  at android.os.Looper.loop (Looper.java:288)
  at android.app.ActivityThread.main (ActivityThread.java:7839)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1003)

Media

NA

Bug Report

  • [X] You will email the zip file produced by adb bugreport to [email protected] after filing this issue.

nishantkp avatar Oct 08 '24 14:10 nishantkp

Thanks for your report.

I think we'd need to repro this with the demo app somehow. The reason is mostly that the cause for a OOO is usually a memory leak and that leak is not necessarily where the OOM is thrown. That is just the unlucky code side that wants to acquire memory next and doesn't have some available.

In this case IMA wants to format a string when the OOM is happening. It's unlikely that this is the reason for the OOM.

I think we'd need more information and ideally a repro in the demo app. If that's not possiblle and you can repro with your app, then you probably need to do a full bug report ion that device just after it happens. A heap dump would be helpful as well as this would probably show where the memory leak is. If you do that you can see where the memory is consumed, and you probably also can observe the memory growing which probably allows you to indentify the culprit. This could be the IMA SDK, the Media3 library and your app. We could do this on our, if we can repro with the demo app.

So please let us know if you have more info for us to proceed with.

If you're unable to share bug reports or test content publicly, please send them to [email protected] using a subject in the format "Issue #1790". Please also update this issue to indicate you’ve done this.

marcbaechinger avatar Oct 14 '24 16:10 marcbaechinger

Yeah, I will try that.

I noticed each time OOM happens, an Ad is playing. Could it be related to a long ad title since it comes from StringBuilder?

I noticed that sometimes they have around 200 characters - which it should not. We can easily address that in GAM.

nishantkp avatar Oct 17 '24 17:10 nishantkp

@marcbaechinger I have sent a full bug report.

nishantkp avatar Oct 17 '24 20:10 nishantkp