Bug 172790 - Out of memory crash with MapBox-gl-js
Summary: Out of memory crash with MapBox-gl-js
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: Safari 10
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-05-31 17:45 PDT by zac spitzer
Modified: 2018-07-09 23:49 PDT (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zac spitzer 2017-05-31 17:45:18 PDT
quoted from https://github.com/mapbox/mapbox-gl-js/issues/4695#issuecomment-305221298

I've been digging deeper into this, and it seems like there is a memory leak in Safari on both mobile and desktop for mapbox-gl-js.

All mobile debugging have been done with the basic mapbox example https://www.mapbox.com/mapbox-gl-js/examples/ 
on an iPad Pro 6,3 (2 GB ram) running iOS 10.3.1. Desktop debugging was done on OS X Safari 10.1.
Comment 1 zac spitzer 2017-05-31 17:52:35 PDT
The error message is "A problem occurred with this webpage so it was reloaded" adding it so people can find this bug if looking for it
Comment 2 Radar WebKit Bug Importer 2017-05-31 19:54:27 PDT
<rdar://problem/32503598>
Comment 3 Simon Fraser (smfr) 2017-06-08 15:10:13 PDT
There does look to be a WebGL-related leak here. We'd have to check whether the page is entraining the data.
Comment 4 Kristian F 2017-08-18 01:50:29 PDT
@smfr, we're unable to isolate the issue to a single aspect of mapbox-gl-js. In addition, the same benchmarking tests causes another popular web-gl based map library, Tangram [https://github.com/tangrams/tangram] to crash on iOS devices as well. See https://github.com/mapbox/mapbox-gl-js/issues/4695#issuecomment-323087798 for details.

Let me know if you'd like an isolated test case for this issue.
Comment 5 Brady Eidson 2017-08-19 10:09:33 PDT
(In reply to Kristian F from comment #4)
> @smfr, we're unable to isolate the issue to a single aspect of mapbox-gl-js.
> In addition, the same benchmarking tests causes another popular web-gl based
> map library, Tangram [https://github.com/tangrams/tangram] to crash on iOS
> devices as well. See
> https://github.com/mapbox/mapbox-gl-js/issues/4695#issuecomment-323087798
> for details.
> 
> Let me know if you'd like an isolated test case for this issue.

The answer to “would you like an isolated reproducible test case?” is almost always *yes* :)

Thanks for your help tracking this down!
Comment 6 Kristian F 2017-08-22 01:53:26 PDT
@brady:

Np, let me know if there is anything else I can do to help resolve this!


You'll find a test example here: https://kristfal.github.io/mapbox-memory-test/

To reproduce a OOM crash:

1) Open the web page above on an iPad. They make the best test case due to larger screen size. I'd recommend using an iPad A1475 or another model with 1 GB RAM for consistent and quick results
2) Press Start in the top left corner and the map will start animating through a predefined path and load map tiles as it animates
3) Memory usage will continue to increase until the browser tab eventually crashes and reloads with the 'A problem occurred..' message

For iPads with 2GB memory, this happens when the com.apple.Webkit process has consumed between 750 and 850 MB of "Real memory". For iPads with 1GB memory, this happens at around 400 - 500 MB.

Drop me a line if you have any questions or if you're unable to reproduce the crash.
Comment 7 juhani.lavonen 2018-04-23 23:38:15 PDT
Any updates on this? The memory leak and Safari crashing is release blocker for our customer and we would like to know what is the status of this bug? As stated earlier in this thread the crashing happens both in desktop and mobile Safari. We’ve also came across this memory leak when mapbox-gl-js map was removed and re-initialised. Currently we’re working on workarounds by removing and re-initialising the map from time to time but this causes map to blink and it is not a viable solution on a long run.
Comment 8 Simon Fraser (smfr) 2018-04-24 10:43:52 PDT
(In reply to Kristian F from comment #6)
> @brady:
> 
> Np, let me know if there is anything else I can do to help resolve this!
> 
> 
> You'll find a test example here:
> https://kristfal.github.io/mapbox-memory-test/


This test doesn't work:
[Error] Failed to load resource: the server responded with a status of 401 (Unauthorized) (streets-v9, line 0)
Comment 9 Aaron 2018-06-16 08:11:24 PDT
Any update on this? +1
Comment 10 Justin Fan 2018-06-18 16:43:43 PDT
I'm having trouble reproducing this with the map box example site on an iPad Pro 6,3 (as originally reported) running iOS 12. If you are still seeing this, please post your SW/HW configuration.

Kristian's test seems to be relying on an expired API key.
Comment 11 zac spitzer 2018-07-09 23:49:28 PDT
Kristian has fixed the test
https://github.com/mapbox/mapbox-gl-js/issues/4695#issuecomment-399054123