GoogleCloudPlatform / GoogleCloudPlatform/cloud-workstations-custom-image-examples

`android-studio-for-platform`: Build hangs, requiring a Private Pool due to high memory usage

Open
#1 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
No language data
Stars
13
Forks
11
PR merge metrics
No merged PRs in 30d

Description

# Affected Directory

[https://github.com/GoogleCloudPlatform/cloud-workstations-custom-image-examples/blob/main/examples/images/android-open-source-project/android-studio-for-platform](https://www.google.com/search?q=https://github.com/GoogleCloudPlatform/cloud-workstations-custom-image-examples/blob/main/examples/images/android-open-source-project/android-studio-for-platform)

# Problem Description

When attempting to build the container image using the provided `cloudbuild.yaml` on a standard worker like `n1-highcpu-32`, the build process does not complete. It hangs indefinitely during the linking phase without producing a specific "out of memory" error.

The process stalls with messages similar to the following:

```
#20 1677.8 [17,362 / 17,393] Linking external/+_repo_rules3+swiftshader/libvk_swiftshader.so; 358s local ... (14 actions running)
```

# Cause Analysis

Although no explicit error was thrown, we suspected the build was failing due to insufficient memory.

To verify this, we switched the build environment to a Cloud Build private pool configured with a machine instance that has **64 GiB of memory**. On this higher-memory machine, the build completed successfully. This strongly suggests that the hanging issue is caused by memory exhaustion.

# Suggested Solution

Standard Cloud Build workers are limited to machine types with a maximum of 32 GiB of memory. As this AOSP build requires more than 32 GiB, it cannot be completed on the default worker pool.

Therefore, **it is necessary to create and use a Cloud Build Private Pool** configured with a machine type that has sufficient memory (e.g., 64 GiB or more) to build this image.

Based on this requirement, I propose the following actions:

1. Update Documentation (`README.md`):
The `README.md` file should be updated to clearly state that **using a Private Pool is mandatory** for this build. It should explain why (the need for \>32 GiB of memory) and include a link to the official Google Cloud documentation on how to create and use a private pool.

2. Update `cloudbuild.yaml`:
To help users configure their build, a commented-out `pool` option could be added to the `cloudbuild.yaml` file as an example.

```yaml
# options:
# pool:
# name: 'projects/YOUR_PROJECT_ID/locations/YOUR_REGION/workerPools/YOUR_POOL_NAME'
```

Thank you for your consideration.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.