Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity8 restarts often due to running out of memory #965

Closed
Talkless opened this issue Nov 24, 2018 · 8 comments

Comments

Projects
3 participants
@Talkless
Copy link

commented Nov 24, 2018

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Author

commented Nov 24, 2018

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

@dobey

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

commented Nov 26, 2018

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

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Member

commented Dec 7, 2018

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

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Member

commented Dec 8, 2018

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 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 join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.