New issue
Advanced search Search tips

Issue 706713 link

Starred by 1 user

Issue metadata

Status: Archived
Owner:
Closed: Apr 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

JNI global reference leak for media.remote.RemoteMediaPlayerBridge

Reported by goandd...@gmail.com, Mar 30 2017

Issue description

Example URL:
https://jsfiddle.net/g4dhv38o/

Steps to reproduce the problem:
1. use chrome to play the web page
2. play the video for about 51xxx times
3. chrome apk exits with JNI error 

What is the expected behavior?
chrome can play it correctly

What went wrong?
Chrome APK exits with attached log 

Did this work before? N/A 

Is it a problem with Flash or HTML5? HTML5

Does this work in other browsers? Yes

Chrome version: 56.0.2815.1  Channel: stable
OS Version: android 4.4, android 5, and android 6
Flash Version: 

Contents of chrome://gpu: 

I change the android global reference table size from 51200 to 1024 to speedup the reproducing. And it seems like RemoteMediaPlayerBridge leaks the object as video playing.

I check RemoteMediaPlayerBridge JNI file and found the global reference objects were not released after video finished.
 
chromeV54.log
12.6 KB View Download
Cc: avayvod@chromium.org tguilbert@chromium.org
Cc: dalecur...@chromium.org
Owner: wolenetz@chromium.org
Status: Assigned (was: Unconfirmed)
remove from untriaged bucket. give to matt to start.
wolenetz@, please feel free to assign appropriately.
Cc: -avayvod@chromium.org torne@chromium.org
Owner: avayvod@chromium.org
I think it's for me or Thomas to take a look :)
cc:torne who's the JNI reference expert.
Cc: qin...@chromium.org
Thanks for taking this one, avayvod@/tguilbert@

Cc: -qin...@chromium.org

Comment 6 by torne@chromium.org, Apr 25 2017

The only global ref in remote_media_player_bridge is the one holding a reference to the Java peer, and it's a normal ScopedJavaGlobalRef member, so if those are leaking then it's probably just a side effect of the C++ object itself leaking?

Comment 7 Deleted

Owner: tguilbert@chromium.org
Thomas, could it be some HLS related change then that leaks MediaPlayerBridge?
The report lists M56, but the log seems to come from M52. In both cases, it is unlikely HLS related changes introduced this bug. The MediaPlayerRenderer was only turned on by default in M57 (although, in M56, the code was present but off).
Owner: avayvod@chromium.org
Will take a look then!
I found that the remote_media_player_bridge.cc would create global JNI objects by java_bridge_.Reset(). And the objects are never released by java_bridge.Reset().

when video finished, remote_media_player_manager only call the bridge's onPlayerDestroyed() and java_bridge.Reset is not called


Comment 12 by torne@chromium.org, Apr 26 2017

The whole point of ScopedJavaGlobalRef is that it releases the reference when destroyed - there's no need to explicitly call Reset() as when the native side object is destroyed the reference will be released.

So, if the Java MediaPlayerBridge objects are leaking, that means that probably the C++ object itself still exists, and so the Java object still existing is not the cause of the problem but just a symptom.
Owner: mlamouri@chromium.org
Status: Untriaged (was: Assigned)
Assigning all my bugs to Mounir for him to triage and close/reassign later.
Status: Assigned (was: Untriaged)
Status: Archived (was: Assigned)
There seems to be no activity and I can't find any recent reference to a similar crash. Please let me know if that's still an issue.

Sign in to add a comment