fix(ci): drop stale Gradle journal locks on the shared /gradle volume
All checks were successful
android-ci / android (pull_request) Successful in 11m30s
All checks were successful
android-ci / android (pull_request) Successful in 11m30s
android-ci failed LockTimeoutException on /gradle/caches/journal-1: two JVMs (PIDs a few apart) sharing onionwire-android-gradle. A cancelled job never docker-rms the build container, so the next run mounts the same volume while the previous Gradle still holds the lock. Also org.gradle.parallel=true in android/gradle.properties. Remove leftover onionwire-android-* containers (and trap EXIT), delete stale *.lock files inside the container, and force parallel=false.
This commit is contained in:
parent
e3fb723a91
commit
9a1f50eadf
2 changed files with 20 additions and 2 deletions
|
|
@ -154,6 +154,12 @@ jobs:
|
|||
rustc --version
|
||||
cargo ndk --version
|
||||
du -sh /opt/android-sdk /cargo /cargo-target /gradle || true
|
||||
# Shared /gradle volume: a killed container leaves journal-1.lock.
|
||||
# android/gradle.properties also sets org.gradle.parallel=true, which
|
||||
# is how two JVMs (PIDs ~5 apart) show up on one lock. Drop the
|
||||
# stale locks and force one Gradle process for this container.
|
||||
find /gradle -name '*.lock' -type f -delete 2>/dev/null || true
|
||||
export GRADLE_OPTS="${GRADLE_OPTS:-} -Dorg.gradle.parallel=false -Dorg.gradle.daemon=false"
|
||||
# No keystore here on purpose: this is a verification build, not a
|
||||
# release build. The script warns that Gradle fell back to the debug
|
||||
# key; that warning is expected in this job.
|
||||
|
|
@ -228,6 +234,12 @@ jobs:
|
|||
docker volume create "$CARGO_VOLUME" >/dev/null
|
||||
docker volume create "$TARGET_VOLUME" >/dev/null
|
||||
docker volume create "$GRADLE_VOLUME" >/dev/null
|
||||
# Cancelled jobs never reach the trailing `docker rm`, so a previous
|
||||
# onionwire-android-* container can still hold GRADLE_VOLUME. The next
|
||||
# Gradle then dies LockTimeoutException on /gradle/caches/journal-1
|
||||
# (owner PID vs our PID a few numbers apart — two JVMs, one volume).
|
||||
trap 'docker rm -f "$BUILD_CONTAINER" >/dev/null 2>&1 || true' EXIT
|
||||
docker ps -aq --filter name=onionwire-android- | xargs -r docker rm -f || true
|
||||
docker rm -f "$BUILD_CONTAINER" >/dev/null 2>&1 || true
|
||||
docker pull "$ANDROID_IMAGE"
|
||||
# 2 GB of Gradle heap, not 1: the only budget in this build that is close
|
||||
|
|
@ -250,7 +262,7 @@ jobs:
|
|||
-e ONIONWIRE_REQUIRE_RELEASE_KEY=false \
|
||||
-e RUST_TOOLCHAIN="$RUST_TOOLCHAIN" \
|
||||
-e ANDROID_CMDLINE_TOOLS_URL="$ANDROID_CMDLINE_TOOLS_URL" \
|
||||
-e GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8" \
|
||||
-e GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.parallel=false -Dorg.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8" \
|
||||
-v "$SDK_VOLUME":/opt/android-sdk \
|
||||
-v "$CARGO_VOLUME":/cargo \
|
||||
-v "$TARGET_VOLUME":/cargo-target \
|
||||
|
|
|
|||
Loading…
Reference in a new issue