Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Unity8 restarts often due to running out of memory #965

Closed
Talkless opened this issue Nov 24, 2018 · 8 comments · Fixed by ubports/lxc-android-config#20
Closed

Unity8 restarts often due to running out of memory #965

Talkless opened this issue Nov 24, 2018 · 8 comments · Fixed by ubports/lxc-android-config#20
Labels
device: krillin BQ Aquaris E4.5 device: vegetahd BQ E5 HD
Projects

Comments

@Talkless
Copy link

Hi,

After upgrading from OTA-3 to OTA-5, Unity has started crashing often. uNav, Reddit webapp, browser invokes crash for whole destkop - Untiy reboots, showing loading dots...

I've noticed that swap space is only 32MB. I believe in Canonical times it was around 500MB, but I might recall badly.

Anyway, I did experiment:

  • Rebooted so that OS memory would be as clear as possible.
  • ssh'ed into it and watched free -m output - it started with about (only!) 270MB available memory.
  • Launched uNav, and kept scrolling as if I was driving. Available memory started to shrink.
  • After some time, available memory got down to tenths of megabytes, and whole Untiy crashed!

Then, I've increaced swap size:

cd /userdata/
sudo swapoff SWAP.img
sudo fallocate -l 1000000000 SWAP.img
sudo mkswap SWAP.img
sudo swapon SWAP.img

After this, uNav did not reproduce system crash. I see about ~180MB of swap used up constantly. System looks more stable, at least for now. 32MB default swap is really unrealistic on this device.

Please increase default swap size at least on small-memory devices such as BQ E5.

@dobey
Copy link
Member

dobey commented Nov 24, 2018

While the concern is understandable, increasing the swap space is not an appropriate solution, as it will greatly reduce the lifespan of the internal storage flash on these devices, due to the vastly increased number of writes that using it as swap would create.

This is I think caused by a bug in the browser, which if I understand correctly, has been improved in the current RC build. Can you test the RC channel to see if this behaves better for you?

@Talkless
Copy link
Author

You mean it's more like a memory leak? Does uNav use the same browser component?

@dobey
Copy link
Member

dobey commented Nov 24, 2018

I don't know if uNav is embedding a web view or not, but it sounds like it is leaking memory if it keeps using more and more as you scroll across the map. I think there was also an issue with unity8's OOM score which might be fixed in devel now as well.

@UniversalSuperBox
Copy link
Member

I tried to decrease Unity8's out-of-memory score, but unfortunately you're not allowed to do that in Upstart session jobs. Seems like no one but root is allowed to set the score adjustments.

@Talkless
Copy link
Author

Talkless commented Dec 7, 2018

I have installed OTA-6. I am still for bigger swap, and I don't care if it shortens life for internal memory (I could though use external SSD for swap I guess?), because it's unusable right now.

With OTA-6, and 32MB SWAP.img, browser do not longer crash Unity - browser itself just WSOD's. I have opened https://www.ermitazas.lt/top-meniu/kontaktai/parduotuves/ and kept scrolling down, to load multiple google maps widgets (showing store locations), until it basically crashes (white page).

uNav still crashes whole Unity desktop after some scrolling though.

After increasing swap to 1GB, I see no such problems, phone is perfectly usable.

@UniversalSuperBox
Copy link
Member

The issue seems to be that zram, which compresses data in RAM, was not getting started on boot on devices where it is configured. ubports/lxc-android-config#20 should fix it.

@Talkless
Copy link
Author

Talkless commented Dec 8, 2018

But that zram is only for android-container, i.e. on android subsystem, drivers..? Or it's more?

Will it actually conserve enough to have significant more memory for apps?

@UniversalSuperBox
Copy link
Member

The E5 and E4.5 allocate 512 MB of zram by default, which is mounted in the Ubuntu userspace. It will not provide you with 1GB more space. You will be able to run apps more like before the 16.04 transition.

@UniversalSuperBox UniversalSuperBox added this to To do in OTA-7 via automation Dec 31, 2018
@UniversalSuperBox UniversalSuperBox moved this from To do to QA in OTA-7 Dec 31, 2018
@UniversalSuperBox UniversalSuperBox changed the title Increace swap space Unity8 restarts often Dec 31, 2018
@UniversalSuperBox UniversalSuperBox added device: krillin BQ Aquaris E4.5 device: arale Meizu MX4 device: vegetahd BQ E5 HD and removed device: arale Meizu MX4 labels Dec 31, 2018
@UniversalSuperBox UniversalSuperBox changed the title Unity8 restarts often Unity8 restarts often due to running out of memory Dec 31, 2018
@mariogrip mariogrip moved this from QA to Done in OTA-7 Jan 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
device: krillin BQ Aquaris E4.5 device: vegetahd BQ E5 HD
Projects
No open projects
OTA-7
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants