question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Updates API / OTA : Android disk usage grows with each OTA update

See original GitHub issue

Environment

Any Expo app.

Steps to Reproduce

  1. Create an Expo app and publish it to the app stores.
  2. Install the app on your device.
  3. Publish OTA updates for your app.
  4. View the app memory footprint on the device before and after the update.

Expected Behavior

Previous (stale) JS bundles are cleared from the device after a new JS bundle is loaded over the air.

Actual Behavior

All prior JS bundles remain on device, this causes the app’s memory usage to grow over time, increasing with each OTA release. For instance, here is the progression of the data reported by Android for our staging app from a fresh install through 3 OTA updates (each update was the same code, just published again):

Fresh install:    32KB
1st OTA update: ~ 8.8MB
2nd OTA update: ~ 12.5MB
3rd OTA update: ~ 18.24MB

Extra Info

I first reported this yesterday on the Expo Forums and was recommended to open an issue here. Previously, our team had assumed Expo apps would keep only the current JS bundle saved on the device, but it appears all downloaded JS bundles remain saved on the device.

This creates a scenario where an app’s memory footprint on a device grows over time, increasing with each OTA update. For JS bundles that are 1-5MB, this could result in app sizes which take up 100s of MB after many updates are pushed. Because of how easy it easy to publish updates OTA, this is a realistic possibility, but very problematic for users and developers if the app size gets to be this large. We first noticed this looking at our staging build (which we publish frequently) which was taking up 200-300MB in total size.

Questions

  • Our team has demonstrated this behavior on Android, but not yet on iOS. It’s unclear to me right now if this behavior is the same on iOS or not. Update: I’m pretty sure this does not happen on iOS.
  • We have not tested yet to see the result if we push new binaries to the App Stores. If pushing a new app binary and updating it clears the extra JS bundles, then this is reasonable to workaround for now because we expect to be building new binaries every 1-3 months or so to keep up with Expo SDK releases.
  • It would be great if Expo could clear stale JS bundles after loading a new OTA update, or, provide some API where developers can opt in to removing these (similar to removing data from the FileSystem provided by Expo.
  • It may be helpful to add more clear documentation about this behavior in the OTA updates section, otherwise people may push updates frequently without being aware of the potential impact to the app size.

Please let me know if I missed anything or if my understanding of Expo is incorrect!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:10
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
quinlanjcommented, Dec 5, 2018

Thanks for reporting this issue. We will look into it 😃

1reaction
esamelsoncommented, Oct 9, 2019

Closing as the fix has been released. We are working on a new Updates module which will have this functionality built in from the start.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reducing OTA Size | Android Open Source Project
This page describes changes added to AOSP to reduce unnecessary file changes between builds. Device implementers who maintain their own ...
Read more >
OTA for Non-A/B Devices with Dynamic Partitions
This page describes how OTA clients resize dynamic partitions during an update for non-A/B devices. For non-A/B devices, the OTA update for ...
Read more >
Manage system updates | Android Developers
This developer's guide explains how your device policy controller (DPC) can manage Android system updates on behalf of the device user.
Read more >
Frequently asked questions | Android Open Source Project
Has Google used A/B OTAs on any devices? Yes. The marketing name for A/B updates is seamless updates. Pixel and Pixel XL phones...
Read more >
OTA Updates | Android Open Source Project
As of Android 8.1, OEMs can push updated time zone rules data to devices without requiring a system update. This mechanism enables users...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found