Jump to content

Pixi.Loader making game to crash when game not in cache


erpresi
 Share

Recommended Posts

Hello, I'm loading a bunch of assets at different stages in my game. For each of them I use a new Pixi.loader that I free up by calling loader.reset(). However, my problem comes when I try to load the assets for the first time (the first loader, the following ones work perfectly), if the game is not in cache then it crashes in some Android devices and some PC's with Chrome. After retrying few times then the game loads 100%

My code is

loader = new PIXI.loaders.Loader()
loader.add("bg.png","static/images/bg.png") // This is a single image
loader.add("static/images/shared1.json") // This is an atlas
loader.add("static/images/mainmenu1.json") // This is an atlas
loader.add("static/images/mainmenu2.json") // This is an atlas
loader.add("static/translations/translations.json") // This is a JSON file
loader.on("progress", this.loadProgressUpdate)
loader.on("error", this.error, this)
loader.once("complete", ()=>{setup()}) // loader.reset() called in setup
loader.load()

The output is:

06-24 10:52:06.381 16778-17309/? W/Adreno-GSL: <sharedmem_gpuobj_alloc:2021>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
06-24 10:52:06.382 16778-17309/? E/Adreno-GSL: <gsl_memory_alloc_pure:2125>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
06-24 10:52:06.384 16778-17309/? W/Adreno-GSL: <sharedmem_gpuobj_alloc:2021>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
06-24 10:52:06.385 16778-17309/? E/Adreno-GSL: <gsl_memory_alloc_pure:2125>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
06-24 10:52:06.467 16778-17309/? W/Adreno-GSL: <sharedmem_gpuobj_alloc:2021>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
06-24 10:52:06.468 16778-17309/? E/Adreno-GSL: <gsl_memory_alloc_pure:2125>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
06-24 10:52:06.470 16778-17309/? W/Adreno-GSL: <sharedmem_gpuobj_alloc:2021>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
06-24 10:52:06.470 16778-17309/? E/Adreno-GSL: <gsl_memory_alloc_pure:2125>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
06-24 10:52:06.472 16778-17309/? W/Adreno-GSL: <sharedmem_gpuobj_alloc:2021>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
06-24 10:52:06.473 16778-17309/? E/Adreno-GSL: <gsl_memory_alloc_pure:2125>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
06-24 10:52:06.476 16778-17309/? W/Adreno-GSL: <sharedmem_gpuobj_alloc:2021>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
06-24 10:52:06.476 16778-17309/? E/Adreno-GSL: <gsl_memory_alloc_pure:2125>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
06-24 10:52:06.478 16778-17309/? W/Adreno-GSL: <sharedmem_gpuobj_alloc:2021>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
06-24 10:52:06.479 16778-17309/? E/Adreno-GSL: <gsl_memory_alloc_pure:2125>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
06-24 10:52:06.480 16778-17309/? W/Adreno-GSL: <sharedmem_gpuobj_alloc:2021>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
06-24 10:52:06.481 16778-17309/? E/Adreno-GSL: <gsl_memory_alloc_pure:2125>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
06-24 10:52:06.481 16778-17309/? I/appstatelogger: Received signum 11. Attempting to update app state log file '/mnt/expand/932a86cd-19e0-47d5-8edd-b0d198d4d237/user/0/com.facebook.orca/app_state_logs/com.facebook.orca_e74ba1f4-0ec1-0d27-156e-4a2ca299a005.txt_native'
06-24 10:52:06.500 16778-17309/? D/appstatelogger: Successfully updated app state log file to status s

It happens in different files at different moments, sometimes at 30%, others at 45% others at 70%... The atlases (created with texturepacker) are smaller than 2048x2048 and the JSON files are like 100KB.

I have tried to:

-Create a loader only for atlases, other for JSON files and other for images -> fail during the atlases with the same output

-Change atlases format -> fail with same output

-Reduce atlases -> fail

I'm totally desperate since I have been trying to fix it since some days ago.  By the way it is an InstantGame


Thanks!

Link to comment
Share on other sites

The app is just using up all of the available memory (RAM) or (GPU) on your device. This can happen when there is a memory leak, several large textures, high res models, etc
*try multipack with texture packer,

*try optimize your files

*check your memory app with (ctrl+alt+delete) on window

* check your memory in the terminal debugger (snapMemory)

image.thumb.png.11d0894f9fc838853272ba352791d3cf.png

*you can also try force arg depending your platform to allow more gpu memory .

ex:

"chromium-args" : "--ignore-gpu-blacklist --force-gpu-mem-available-mb=2000 --show-fps-counter --enable-gpu-rasterization --enable-gpu-memory-buffer-video-frames --enable-native-gpu-memory-buffers ",

 

Link to comment
Share on other sites

Quote

*try multipack with texture packer,

Done. Max texture size is 1024x1024 and aprox 6 atalases in total -> Still crashing

Quote

*try optimize your files

Done. Deleted all unnecessary calls and loaded images as needed doing the smallest amount of calls at the beginning -> Still crashing

Quote

check your memory app with (ctrl+alt+delete) on window

check your memory in the terminal debugger (snapMemory)

Problem is on Android mainly and I have the luck of owning an Android device where is happening, so no able to do it on Windows or Mac (I have tried to reproduce it but I have not achieved in these platforms).  I have tested it in other 8 android devices (including tablets) that I have and it is not happening in them. I only have logcat

Quote

*you can also try force arg depending your platform to allow more gpu memory .


"chromium-args" : "--ignore-gpu-blacklist --force-gpu-mem-available-mb=2000 --show-fps-counter --enable-gpu-rasterization --enable-gpu-memory-buffer-video-frames --enable-native-gpu-memory-buffers ",

I would like to try this approach but I do not know where to place that line. Should I place it in index.js? index.html? I have no idea where/how to include it in a HTML5 game

These are the settings I set before creating the app:

PIXI.glCore.VertexArrayObject.FORCE_NATIVE = true;
PIXI.settings.CAN_UPLOAD_SAME_BUFFER = false
PIXI.settings.RENDER_OPTIONS.legacy = true
PIXI.settings.RENDER_OPTIONS.preserveDrawingBuffer = true
PIXI.settings.RENDER_OPTIONS.antialias = false
PIXI.settings.PRECISION_FRAGMENT = PIXI.PRECISION.LOW
PIXI.settings.PRECISION_VERTEX = PIXI.PRECISION.LOW
PIXI.settings.MIPMAP_TEXTURES = false

I have tried disabling/enabling all them one by one at different moments. Same result.

I made the app to load the files (without running any other method afterwards) and it crash during the load process.

It always crash (only) the first time I run it after releasing a new version of the game or when I have not played in a while. If I open the game after a crash it loads 99% of the times.

For the logs I know is happening in the following devices (at least) Galaxy J6, Grand Galaxy, BQ Aquarius U, among others...

Link to comment
Share on other sites

  • 5 weeks later...

I'm seeing the same problem although we cannot reproduce it on any PC like you mentioned. For us this seems to happen only on certain Android devices at a random point during loading. Like you we're working on Facebook Messenger Instant Games so at the moment I'm thinking it might be related to Messenger's Web View somehow (or Android's Webview in general for that matter). It might be worth testing if this happens on a stand-alone Chrome as well on the afflicted devices. If it does then we can get much more debug info from Chrome remote debugger. But I'll need to strip the Instant Games API calls etc to be able to test it.

As you can see the output is exactly the same:

07-25 19:31:24.112 16597 18756 W Adreno-GSL: <sharedmem_gpuobj_alloc:2318>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-25 19:31:24.112 16597 18756 E Adreno-GSL: <gsl_memory_alloc_pure:2198>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
07-25 19:31:24.116 16597 18756 W Adreno-GSL: <sharedmem_gpuobj_alloc:2318>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-25 19:31:24.117 16597 18756 E Adreno-GSL: <gsl_memory_alloc_pure:2198>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
07-25 19:31:24.133 16597 18756 W Adreno-GSL: <sharedmem_gpuobj_alloc:2318>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-25 19:31:24.133 16597 18756 E Adreno-GSL: <gsl_memory_alloc_pure:2198>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
07-25 19:31:24.139 16597 18756 W Adreno-GSL: <sharedmem_gpuobj_alloc:2318>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
07-25 19:31:24.139 16597 18756 E Adreno-GSL: <gsl_memory_alloc_pure:2198>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
07-25 19:31:24.143 16597 18756 W Adreno-GSL: <sharedmem_gpuobj_alloc:2318>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory

I'll post here when we have more info - hope you'll do the same! ?

Link to comment
Share on other sites

Update: I've been digging deeper into this and it seems to happen exactly like you said. On my Android device if I keep trying to load the game it will eventually load to 100% after which it will work without issues every time. So it is likely related to caching or rather some weird race condition that does not manifest when the loading is fast enough (ie. cached).

Link to comment
Share on other sites

Hello,

Yes I will keep you informed but we have paused the development of Instant Games for a while and we are focussing on making playable ads while we find a solution or another framework more stable for FB Instant Games. However I will keep you posted if we find any possible fix for this.

Thanks.

 

Link to comment
Share on other sites

I managed to "fix" this in our game. As I did some further testing it turned out that this does not happen on a standalone mobile Chrome browser but only inside the Messenger's webview. I say "fix" because I didn't actually find the root cause for this - but since I suspected it was related to the GPU uploads and asset loading somehow, as a workaround I created the PIXI.Application with `autoStart: false` to disable rendering for the initial loading. Then after the load I would call `app.start()`. This way the GPU uploads would happen only after everything is loaded. We had this issue pop up consistently on at least 4 different test devices before, but with this change the loading works 100% on all of them.

It seems that Messenger's webview is either a really old version, or it uses a completely different versioning scheme than the standalone Chrome. Our browser check reported version 68 for the standalone Chrome and 4 (!!!) for the webview. That could easily mean that there are some (a lot?) of bugs in the WebGL implementation.

Cheers!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...