Android IMA SDK StrictMode violation

274 views
Skip to first unread message

Adrian Rodriguez

unread,
Nov 16, 2016, 4:38:57 AM11/16/16
to Interactive Media Ads SDK
I see very frequently the following StrictMode violation coming from the IMA SDK v3-3.4.0

E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
                                                                    java.lang.Throwable: Explicit termination method 'close' not called
                                                                        at dalvik.system.CloseGuard.open(CloseGuard.java:180)
                                                                        at java.io.RandomAccessFile.<init>(RandomAccessFile.java:127)
                                                                        at com.android.webview.chromium.WebViewChromiumFactoryProvider.startChromiumLocked(WebViewChromiumFactoryProvider.java:16107)
                                                                        at com.android.webview.chromium.WebViewChromiumFactoryProvider.ensureChromiumStartedLocked(WebViewChromiumFactoryProvider.java:333)
                                                                        at com.android.webview.chromium.WebViewChromiumFactoryProvider.startYourEngines(WebViewChromiumFactoryProvider.java:427)
                                                                        at com.android.webview.chromium.WebViewChromium.init(WebViewChromium.java:162)
                                                                        at android.webkit.WebView.<init>(WebView.java:618)
                                                                        at android.webkit.WebView.<init>(WebView.java:554)
                                                                        at android.webkit.WebView.<init>(WebView.java:537)
                                                                        at android.webkit.WebView.<init>(WebView.java:524)
                                                                        at android.webkit.WebView.<init>(WebView.java:514)
                                                                        at com.google.ads.interactivemedia.v3.impl.ab.<init>(IMASDK:38)
                                                                        at com.google.ads.interactivemedia.v3.impl.aa.<init>(IMASDK:270)
                                                                        at com.google.ads.interactivemedia.v3.impl.h.<init>(IMASDK:288)
                                                                        at com.google.ads.interactivemedia.v3.impl.h.<init>(IMASDK:282)
                                                                        at com.google.ads.interactivemedia.v3.api.ImaSdkFactory.createAdsLoader(IMASDK:53)

Chris Feldman (IMA SDK Team)

unread,
Nov 16, 2016, 11:52:29 AM11/16/16
to Interactive Media Ads SDK
Hi Adrian,

Thank you for reaching out to IMA SDK Support. I was not able to replicate this behavior in our IMA Sample App for Android with our sample ad tags. Can you please share with me the ad tag that you are using, as well as the specific user steps taken before you see that response?

Regards,
Chris Feldman
IMA SDK Team

Dave

unread,
Mar 28, 2017, 9:43:31 AM3/28/17
to Interactive Media Ads SDK
Hi Chris,

I'm seeing a similar issue. It looks like it's caused by leaving the Activity while playing content when there is a loaded AdsManager with a future midroll to be played. ContentProgressProvider will be polled indefinitely and the Activity will be leaked as a consequence of it being the enclosing class. Destroying the AdsManager doesn't help.
Thank you,
Dave

Chris Feldman (IMA SDK Team)

unread,
Mar 28, 2017, 3:10:59 PM3/28/17
to Interactive Media Ads SDK
Hi Dave,

Did you make any changes to the BasicExample? before testing? I'm not seeing this behavior when I turn on StrictMode and play your tag. Please let me know if there's anything else I need to reproduce this behavior.

Regards,
Chris Feldman
IMA SDK Team

Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Dave

unread,
Mar 28, 2017, 5:50:55 PM3/28/17
to ima...@googlegroups.com
Hi Chris,

I've attached the project I used to reproduce.

There are 3 symptoms that I believe are related. The latter 2 are easier to reproduce.
  1. The original StrictMode CloseGuard violation
  2. Indefinite polling of ContentProgressProvider
  3. Activity leak StrictMode violation

  • Steps to reproduce
    • Enable "Strict Mode".
    • Enable "Don't keep activities".
    • Start MyActivity.
    • Wait until the pre-roll ad completes and content starts playing. You should see "getContentProgress() returns ..." being polled and logged.
    • Press back to leave MyActivity while content is playing.
    • MyActivity should be destroyed, but finalize won't be called and "getContentProgress()" will be polled and logged indefinitely.
    • Repeat and you'll see the StrictMode violation.
I added log statements in "onDestroy()" and "finalize()" for MyActivity and VideoFragment. You'll see that onDestroy() is called, but finalize is not. After starting MyActivity more than once, you can see the StrictMode violation.

03-28 14:11:44.935 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/MyActivity: onDestroy() called
03-28 14:11:44.935 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: onDestroy() called
03-28 14:11:45.107 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp E/StrictMode: class com.google.ads.interactivemedia.v3.samples.videoplayerapp.MyActivity; instances=2; limit=1
                                                                                                   android.os.StrictMode$InstanceCountViolation: class com.google.ads.interactivemedia.v3.samples.videoplayerapp.MyActivity; instances=2; limit=1
                                                                                                       at android.os.StrictMode.setClassInstanceLimit(StrictMode.java:1)

03-28 14:14:07.927 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:08.167 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:08.407 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:08.647 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:08.887 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:09.127 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:09.367 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:09.608 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:09.847 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:10.087 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:10.327 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:10.567 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:10.807 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:11.047 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:11.287 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:11.527 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:11.767 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]
03-28 14:14:12.007 758-758/com.google.ads.interactivemedia.v3.samples.videoplayerapp D/VideoFragment: getContentProgress() returned VideoProgressUpdate [currentTime=-0.001, duration=-0.001]


Thanks,
Dave

--
You received this message because you are subscribed to a topic in the Google Groups "Interactive Media Ads SDK" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ima-sdk/tddgTV61SG4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ima-sdk+unsubscribe@googlegroups.com.
To post to this group, send email to ima...@googlegroups.com.
Visit this group at https://groups.google.com/group/ima-sdk.
For more options, visit https://groups.google.com/d/optout.

BasicExample-leak.tar.gz

Chris Feldman (IMA SDK Team)

unread,
Mar 29, 2017, 3:37:09 PM3/29/17
to Interactive Media Ads SDK
Hi Dave,

Thank you for providing more information. I will continue to investigate this issue.

Regards,
Chris Feldman
IMA SDK Team

Dave

unread,
Apr 5, 2017, 11:55:35 AM4/5/17
to Interactive Media Ads SDK
Hi Chris,

Do you have any update on this? Were you able to reproduce the issue?

Thanks,
Dave
To unsubscribe from this group and all its topics, send an email to ima-sdk+u...@googlegroups.com.

Chris Feldman (IMA SDK Team)

unread,
Apr 5, 2017, 4:06:01 PM4/5/17
to Interactive Media Ads SDK
Hi Dave,

I was able to reproduce the issue. The team is investigating, and though we don't have an update for you at this time, I will let you know as soon as I have any new information.

Regards,
Chris Feldman
IMA SDK Team

juant...@gmail.com

unread,
Jun 20, 2017, 5:32:57 AM6/20/17
to Interactive Media Ads SDK
Hello Chris,

We were wondering if there's any update on this. I know you would let OP know but not sure if you meant that you will publicly let us know.

This is a rather severe problem if you work on apps that serve lots of video. Any workarounds would be appreciated.

Thanks,

Chris Feldman (IMA SDK Team)

unread,
Jun 20, 2017, 3:03:17 PM6/20/17
to Interactive Media Ads SDK
Hi,

Thank you for reaching out about this issue. We are still looking into possible solutions. I will let you know as soon as I have more information.

Regards,
Chris Feldman
IMA SDK Team

Jin Wang

unread,
Apr 6, 2018, 12:55:34 AM4/6/18
to Interactive Media Ads SDK
I'm seeing the same issue here using version 3.7.4. Is there any update on this? This issue is causing activity leaking which is pretty serious.

Chris Feldman (IMA SDK Team)

unread,
Apr 6, 2018, 2:59:42 PM4/6/18
to Interactive Media Ads SDK
Hi,

Can you please try testing on the latest version of the SDK? I'm no longer able to reproduce the issue.

Regards,
Chris Feldman
IMA SDK Team

Jin Wang

unread,
Apr 8, 2018, 9:55:16 PM4/8/18
to Interactive Media Ads SDK
Hey Chris,

Thanks for the reply. I can confirm that IMA SDK v3.8.2 has fixed this issue.

However, since we're using ExoPlayer, the latest version suffers from the issue mentioned here https://github.com/google/ExoPlayer/issues/3911. I know this is a separate issue, but just FYI.

Thanks again.

Chris Feldman (IMA SDK Team)

unread,
Apr 9, 2018, 11:25:23 AM4/9/18
to Interactive Media Ads SDK
Hi,

Thank you for following up. I'm glad to hear that your issue has been resolved. Regarding the ExoPlayer issue, our team has no control over what version of the SDK their player is using. That being said, I can tell you that our team has resolved the IMA issue that is blocking them from updating. The fix should go live in an upcoming SDK release (release notes).

Regards,
Chris Feldman
IMA SDK Team

Reply all
Reply to author
Forward
0 new messages