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

CI failing in Android build as out of memory #1330

Closed
gnprice opened this issue Feb 5, 2025 · 2 comments · Fixed by #1324
Closed

CI failing in Android build as out of memory #1330

gnprice opened this issue Feb 5, 2025 · 2 comments · Fixed by #1324
Labels
a-Android Issues specific to Android, or requiring Android-specific work a-tools Our own development tooling, scripts, and infrastructure

Comments

@gnprice
Copy link
Member

gnprice commented Feb 5, 2025

Starting Monday around 48 hours ago, our CI runs have all been failing with a "Java heap space" error in the android suite, like this:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Error while evaluating property 'friendPathsSet$kotlin_gradle_plugin_common' of task ':app:compileDebugKotlin'.
   > Could not resolve all files for configuration ':app:debugCompileClasspath'.
      > Failed to transform armeabi_v7a_debug-1.0.0-1b328e5729f5f67e0c5eef98e71346eab09362d4.jar (io.flutter:armeabi_v7a_debug:1.0.0-1b328e5729f5f67e0c5eef98e71346eab09362d4) to match attributes {artifactType=android-classes-jar, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-api}.
         > Execution failed for JetifyTransform: /home/runner/.gradle/caches/modules-2/files-2.1/io.flutter/armeabi_v7a_debug/1.0.0-1b328e5729f5f67e0c5eef98e71346eab09362d4/b10386682e6ae1fede7cec7ff90ed6852c8a3d64/armeabi_v7a_debug-1.0.0-1b328e5729f5f67e0c5eef98e71346eab09362d4.jar.
            > Java heap space

So the JVM under Gradle is running out of memory.

The workaround is we'll increase the limit of memory Gradle is allowed to use, in #1324.

It turns out the increase in needed memory is real steep, though — the limit was 1.5 GiB and it was running fine, and now (as @PIG208 determined in #1324) even 2.5 GiB isn't enough. (The PR makes it 3 GiB.) So it'd be good to spend a bit of time trying to pin down what caused the change, to see if there's something to fix upstream.

Chat thread: https://chat.zulip.org/#narrow/channel/516-mobile-dev-help/topic/Execution.20failed.20for.20task.20'.3Aapp.3AcompileDebugKotlin'/near/2076887

@gnprice gnprice added a-Android Issues specific to Android, or requiring Android-specific work a-tools Our own development tooling, scripts, and infrastructure labels Feb 5, 2025
@gnprice gnprice closed this as completed in ca26330 Feb 5, 2025
@gnprice
Copy link
Member Author

gnprice commented Feb 5, 2025

After some further investigation:

The failures started when this upstream PR landed:

A CI run succeeded using the upstream commit just before that one; and then the next CI run used that upstream commit, and CI failed consistently from there.

That PR is intentionally adding another step that happens in Android builds, when the Android NDK gets downloaded. Discussion on this upstream issue:

which is about the effect on run times; it's unsurprising that it also affects memory use.


It's a bit unfortunate that Flutter Android builds in a CI environment are now substantially more memory-hungry (was <1.5 GiB, now >2.5 GiB), and presumably slower too. But so be it — the new step serves a valuable purpose: flutter/flutter#60240 (comment)

And a mitigating factor is that this seems to only affect running in a more or less fresh environment, like in CI — when I tried to reproduce on my desktop, the build consistently worked even with the old 1.5 GiB limit.

rishichirchi pushed a commit to rishichirchi/zulip-flutter that referenced this issue Feb 7, 2025
Fixes zulip#1330.

Since Monday, CI builds have been running out of memory,
presumably due to some upstream change.  Allocate more memory
so that the CI can pass again.

The limit was 1.5 GiB, but now even 2.5 GiB doesn't seem to be
enough.  So increase it to 3 GiB.

CZO discussion:
  https://chat.zulip.org/#narrow/channel/516-mobile-dev-help/topic/Execution.20failed.20for.20task.20'.3Aapp.3AcompileDebugKotlin'/near/2076887

Signed-off-by: Zixuan James Li <[email protected]>
@gnprice
Copy link
Member Author

gnprice commented Feb 8, 2025

Update: #1324 increasing the limit to 3 GiB made CI pass most of the time (instead of never), but it's been flaky:
https://chat.zulip.org/#narrow/channel/243-mobile-team/topic/Gradle.20out.20of.20memory/near/2082072

In #1331 we bumped the limit further, to 4 GiB. We'll monitor to see if flakes continue.

github-actions bot pushed a commit that referenced this issue Feb 12, 2025
Fixes #1330.

Since Monday, CI builds have been running out of memory,
presumably due to some upstream change.  Allocate more memory
so that the CI can pass again.

The limit was 1.5 GiB, but now even 2.5 GiB doesn't seem to be
enough.  So increase it to 3 GiB.

CZO discussion:
  https://chat.zulip.org/#narrow/channel/516-mobile-dev-help/topic/Execution.20failed.20for.20task.20'.3Aapp.3AcompileDebugKotlin'/near/2076887

Signed-off-by: Zixuan James Li <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-Android Issues specific to Android, or requiring Android-specific work a-tools Our own development tooling, scripts, and infrastructure
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant