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

fix(MM-62375): OOM on gif #8573

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

fix(MM-62375): OOM on gif #8573

wants to merge 3 commits into from

Conversation

rahimrahman
Copy link
Contributor

Summary

Ticket Link

Fixes: https://mattermost.atlassian.net/browse/MM-62375

See changes in my own fork of APNG4Android (until I have permission to post to mattermost/APNG4Android): rahimrahman/APNG4Android@74dd31c

Checklist

  • Added or updated unit tests (required for all new features)
  • Has UI changes
  • Includes text changes and localization file updates
  • Have tested against the 5 core themes to ensure consistency between them.
  • Have run E2E tests by adding label E2E iOS tests for PR.

Device Information

This PR was tested on:

Google Pixel 6a, Android 14

Screenshots

Release Note


@mm-cloud-bot mm-cloud-bot added kind/bug Categorizes issue or PR as related to a bug. release-note labels Feb 8, 2025
Comment on lines +10 to +15
+ implementation project(':frameanimation')
+ implementation project(':gif')
+ implementation("com.github.penfeizhou.android.animation:glide-plugin:3.0.2") {
+ exclude group: 'com.github.penfeizhou.android.animation', module: 'frameanimation'
+ exclude group: 'com.github.penfeizhou.android.animation', module: 'gif'
+ }
Copy link
Contributor Author

@rahimrahman rahimrahman Feb 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fixes are in frameanimation & gif.

Now in this PR (that will not get merged).

Comment on lines 49 to 52
APNG4Android="node_modules/APNG4Android"
if [ ! -z "$APNG4Android" ]; then
git clone -b "fix/MM-62375-oom-on-gif" --single-branch https://github.com/rahimrahman/APNG4Android.git "$APNG4Android";
fi
Copy link
Contributor Author

@rahimrahman rahimrahman Feb 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't do npm i since APNG4Android doesn't have package.json.

  • TODO: will replace with mattermost/APNG4Android (as soon as permission to write is granted)
  • TODO: figure out if I can use SHA instead of branch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No you cannot clone a specific commit, but you can clone the branch and then do a checkout

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also use --depth=1 so that it only clones the latest one

Comment on lines +11 to +14
include ':frameanimation'
project(':frameanimation').projectDir = new File('../node_modules/APNG4Android/frameanimation')
include ':gif'
project(':gif').projectDir = new File('../node_modules/APNG4Android/gif')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to get this as project in expo-image/android/build.gradle, need to declare frameanimation and gif here.

Comment on lines +13 to +14
+ exclude group: 'com.github.penfeizhou.android.animation', module: 'frameanimation'
+ exclude group: 'com.github.penfeizhou.android.animation', module: 'gif'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without exclusions, it will cause duplicate symbols error. Since glide-plugin will have frameanimation (required module) in other modules (apng, webp, etc).

@rahimrahman rahimrahman requested review from enahum and larkox February 8, 2025 18:58
@rahimrahman rahimrahman added the Build Apps for PR Build the mobile app for iOS and Android to test label Feb 8, 2025
@rahimrahman rahimrahman added Build App for Android Build the mobile app for Android and removed Build Apps for PR Build the mobile app for iOS and Android to test labels Feb 8, 2025
run: |
echo "::group::clone-APNG4Android"
if [ ! -d "$APNG4Android" ]; then
git clone -b "fix/MM-62375-oom-on-gif" --single-branch https://github.com/rahimrahman/APNG4Android.git "$APNG4Android";
Copy link
Contributor Author

@rahimrahman rahimrahman Feb 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any benefit of putting it into node_modules instead of a custom folder on the root path of the app?

  • TODO: Will replace this with the correct repo (mattermost/APNG4Android)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Irrelevant in my opinion, but of it works here no need to change

Copy link
Contributor Author

@rahimrahman rahimrahman Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like node_modules because it's easier to do the npm run clean and it'll auto-clean this library as well. But I could also have added an extra line to clean the folder wherever it might be in scripts/clean.sh as well.

I'll stick with node_modules.

@rahimrahman rahimrahman added Build App for Android Build the mobile app for Android and removed Build App for Android Build the mobile app for Android labels Feb 9, 2025
@@ -54,7 +54,7 @@
"expo-application": "6.0.1",
"expo-crypto": "14.0.1",
"expo-device": "7.0.1",
"expo-image": "2.0.3",
"expo-image": "2.0.4",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to bump this? Just curious

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a mistake when reading the changelog. And looking at the changes, I thought the addition of try..catch was going to help, but it didn't. Looking deeper, I noticed that it was already implemented in 2.0.3, not a new change in 2.0.4.

Changelog for 2.0.4:

## 2.0.4 — 2025-01-10

_This version does not introduce any user-facing changes._

So it's pretty moot.

Comment on lines 49 to 52
APNG4Android="node_modules/APNG4Android"
if [ ! -z "$APNG4Android" ]; then
git clone -b "fix/MM-62375-oom-on-gif" --single-branch https://github.com/rahimrahman/APNG4Android.git "$APNG4Android";
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No you cannot clone a specific commit, but you can clone the branch and then do a checkout

Comment on lines 49 to 52
APNG4Android="node_modules/APNG4Android"
if [ ! -z "$APNG4Android" ]; then
git clone -b "fix/MM-62375-oom-on-gif" --single-branch https://github.com/rahimrahman/APNG4Android.git "$APNG4Android";
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also use --depth=1 so that it only clones the latest one

@rahimrahman rahimrahman added Build Apps for PR Build the mobile app for iOS and Android to test and removed Build App for Android Build the mobile app for Android labels Feb 10, 2025
@rahimrahman
Copy link
Contributor Author

@yasserfaraazkhan I'm flagging you for QA review, but @enzowritescode has done the test with his Android device and ✅ it in our private DM.

You're welcome to test this as well for redundancy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3: Security Review Review requested from Security Team Build Apps for PR Build the mobile app for iOS and Android to test kind/bug Categorizes issue or PR as related to a bug. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants