Android 5 Chrome 55 timetexture_definition.cc eglCreateImageKHR for cross-thread sharing failed

474 views
Skip to first unread message

Jeremy

unread,
Jan 22, 2017, 5:16:38 PM1/22/17
to phonegap
Hi,

I am testing my Cordova 5.0 app on my Samsung Galaxy 4.  Hardware acceleration is enabled. Android System Webview version 55.0.2883.91 installed.  Consoling the Javascript navigator.userAgent shows:
"Mozilla/5.0 (Linux; Android 5.0.1; GT-I9500 Build/LRX22C; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/55.0.2883.91 Mobile Safari/537.36"

It has no video.  It has a page that uses iScroll 4 to add a carousel of 4 images using the IMG tag.  When the page is not visible it's removed from the DOM entirely and the iScroll object is also nulled and removed.

After some time, the app crashes with:
01-22 22:59:36.963: E/IMGSRV(15756): :0: PVRPMapKMem: mmap(2) failed: Mapping handle=0x1593: Operation not permitted
01-22 22:59:36.963: E/IMGSRV(15756): :0: PVRSRVAllocDeviceMem : PVRPMapKMem failed for buffer 
01-22 22:59:36.968: E/IMGSRV(15756): :0: PVRPMapKMem: mmap(2) failed: Mapping handle=0x1595: Operation not permitted
01-22 22:59:36.968: E/IMGSRV(15756): :0: PVRSRVAllocDeviceMem : PVRPMapKMem failed for buffer 
01-22 22:59:36.968: E/IMGSRV(15756): :0: GLESGetImageSource: Can't make texture resident
01-22 22:59:36.968: E/IMGSRV(15756): :0: IMGeglCreateImageKHR: Generic error
01-22 22:59:36.968: E/chromium(15756): [ERROR:texture_definition.cc(177)] eglCreateImageKHR for cross-thread sharing failed: 0x300c

I read about a bug in the texture_definition.cc file when playing video - https://bugs.chromium.org/p/chromium/issues/detail?id=480992

This is for Webview 42.0.2311.129, a much older version than what I am using! I am also not playing video, I am drawing <IMG> images to the DOM. Nothing that will make the GPU go crazy.

So, I don't know why I am getting this related bug! And googling doesn't provide any insight which suggests I am the only one! This can't be...

Any ideas?

Many thanks.

Kerri Shotts

unread,
Jan 24, 2017, 12:21:30 PM1/24/17
to phonegap
You might try the Crosswalk plugin and see if things behave any better.

On Sunday, January 22, 2017 at 4:16:38 PM UTC-6, Jeremy wrote:
...

Jeremy

unread,
Jan 26, 2017, 6:42:13 AM1/26/17
to phonegap
Hi Kerri,

Thanks for your reply.  The Crosswalk plugin is a headache to get to run.  I tried this for a few days and gave up.  I also found lots of people having trouble to get it to work. My app's speed is ok, I just want simple things to work without it crashing!  iOS WKWebView is a much faster and more stable webview! My app runs perfectly on iOS.

If nobody else has seen this issue then I feel that I've done something dumb in my code for the Android webview to cause such a crash.  I'll back out my code bit by bit and test to try and track the issue.

Kerri Shotts

unread,
Jan 26, 2017, 12:48:32 PM1/26/17
to phonegap
Is the webview version being used when crashing the latest version? It isn't unheard of for Android webview updates causing issues for Cordova apps -- which is why I suggest Crosswalk now. Performance is less of an issue with modern Android web views, but consistency and stability is -- you are in control of when you update Crosswalk, whereas the Android webview can be updated at any time, and may cause your app to blow up.

If you can, try your app's code in Chrome on Android -- does it exhibit the same problem? (This assumes you aren't dependent upon plugins, or can work around the lack thereof.)

It wouldn't hurt to share your code if you can -- maybe one of us will catch something.

(Also: what problems were you having with Crosswalk? In general, I've found it very easy to get going.)

On Thursday, January 26, 2017 at 5:42:13 AM UTC-6, Jeremy wrote:
...

Jeremy

unread,
Jan 27, 2017, 7:38:39 AM1/27/17
to phonegap
yes, the webview is being used. I spent a few days getting CrossWalk to run and I couldn't.  I think my issue was with clashes with Android jars from Facebook and Crosswalk. It always failed to run.  So I gave up.  Do you have an easy tutorial to follow to install it?

Is your app stable running in Crosswalk?

Kerri Shotts

unread,
Jan 27, 2017, 10:19:36 AM1/27/17
to phonegap
So, it looks like there was a new update to the system web view on the 25th -- if you update does the problem still occur?

Jeremy

unread,
Jan 27, 2017, 11:12:47 AM1/27/17
to phonegap
Hi, I am looking at https://www.apk4fun.com/history/47404/ and see the last update was Dec 14, 2016 to the version I have.  So I am up-to-date.

Where do you see a new release on jan 25?

Jeremy

unread,
Jan 27, 2017, 11:23:25 AM1/27/17
to phonegap
I see the new version you mentioned in Google Play on my laptop - version 56.0.2924.78.

But Google Play on my phone shows the latest version at 55.0.2883.91, available from Dec 9, 2016!

I am using Android 5.0.1 so the newer version should be available for it!  I'll investigate why my phone doesn't show the latest version!

Jeremy

unread,
Jan 27, 2017, 3:25:00 PM1/27/17
to phonegap
I had to manually download the version 56 APK and install it.  It hasn't made any difference to my app crashing on occasion.

Thanks for your help, I'll back out my code bit by bit until I find what's making the Webview crash.

Jeremy

unread,
Feb 26, 2017, 5:36:50 PM2/26/17
to phonegap
Hi Kerry,

Have you noticed that Cordova apps on Android are slower than on iOS?  The Chromium browser (even the latest that is updatable from google play) seems to have a slower javascript engine!

Kerri Shotts

unread,
Feb 26, 2017, 9:43:02 PM2/26/17
to phonegap
Jeremy,

Yes; Android is nowhere near as fast as iOS when it comes to single-core JavaScript performance, which is really unfortunate. It's not that multi-core performance can't be similar, but that doesn't matter much to a single-threaded JavaScript engine. (And yes, the engines are also different. Android uses Chrome's V8 engine, while iOS offers UIWebView (slow) and WKWebView (much faster than UIWebView via JIT compilation).

Compare the single-core GeekBench 4 numbers for Android (https://browser.primatelabs.com/android-benchmarks/), and iOS. Notice that the highest performer on the Android side is roughly equivalent to an iPad Air 2. Now, that's not to say an iPad Air 2's performance is bad (it isn't), but there are an awful lot of reasonably current Android devices sitting at iPhone 5s and less speeds. I've got a Samsung Tab S 8.4" tablet that comes in just short of an iPad 4's performance, and its single-threaded JS performance is horrible.

Granted, these are benchmarks -- they don't always reflect real-world use, but they've been reasonably reliable indicators in my experience. My iDevices (even older ones) have always run circles around my Droids. (This has generally been the case natively as well, but it's really obvious with JS.)

Things have improved (as you can see from the higher numbers as of late), but they are still far from ideal. 

So, yes: Android devices are way slower than Apple devices. And this is especially true when you get down into the cheaper range. A Kindle Fire HDX (3rd gen) comes in around 960, but those aren't cheap. A Kindle Fire HD lands in the 480s, or a bit faster than an iPad 2 (333), but not nearly as fast as an iPhone 5c (716).

So, what can you do?

 - Live with the speed difference -- the single-core performance gap is real
 - Utilize workers -- workers run on their own thread.
 - Reduce list sizes -- for example, an iPad may have no problem rendering a really long list, but you might need to halve the list size for an Android. (This is assuming you aren't using an infinite scrolling list)
 - Reduce animations -- On Android I will often remove view animations. It's faster, and hides the jerkiness of the animation. I have full animations running beautifully on iOS, however.
 - Reduce complex styles -- same reason
 - Affordances, affordances, affordances -- let the user know that you heard them and utilize tricks to improve apparent responsiveness (note that apparent != actual performance!) 
 - Optimize. Anything you can do to help speed things up helps tremendously on an Android device. Memoization can help dramatically as well (but with a memory cost).
 - And if you're using Babel to transpile, switch to loose mode. It's not a huge boost, but it helps.
 - Profile, profile, profile. Find out where the speed bumps are, and target those for improvement.

On Sunday, February 26, 2017 at 4:36:50 PM UTC-6, Jeremy wrote:
Hi Kerry,

Have you noticed that Cordova apps on Android are slower than on iOS?  The Chromium browser (even the latest that is updatable from google play) seems to have a slower javascript engine!

...
Reply all
Reply to author
Forward
0 new messages