From de2b9d22b439fd2245ba69360d357dade26cbce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bot=20of=20Thomas=20G=C3=BCttler?= Date: Wed, 10 Jun 2026 13:13:28 +0200 Subject: [PATCH] fix(ci): stop gradle daemon between flutter build apk and assembleAndroidTest (#554) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary The Firebase Test Lab job (issue #549) failed because `flutter build apk --debug --no-pub` spawned a Gradle daemon, whose journal-cache lock file was left on the persistent Dagger `gradle-cache` mount after the `WithExec` container was torn down. The next exec, `./gradlew --no-daemon app:assembleAndroidTest`, then timed out after 60s waiting for that stale lock: ``` > Timeout waiting to lock journal cache (/home/ci/.gradle/caches/journal-1). It is currently in use by another process. Owner PID: 88 Our PID: 53 ``` The pre-existing `--no-daemon` only prevented stale daemon-registry reuse, not stale lock files. **Fix:** chain `./gradlew --stop` into the first `WithExec` so the daemon shuts down gracefully and releases its locks before Dagger snapshots the layer. ## Test plan - [ ] CI passes - [ ] Manually re-run the Firebase Tests workflow (`workflow_dispatch`) and confirm the Gradle journal-lock error no longer appears Closes #549 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Till Düßmann (Claude agent) Reviewed-on: https://codeberg.org/guettli/sharedinbox/pulls/554 --- ci/main.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ci/main.go b/ci/main.go index 53f6867..cf9d9b2 100644 --- a/ci/main.go +++ b/ci/main.go @@ -814,7 +814,14 @@ func (m *Ci) DeployApk( // Returns a flat directory with app-debug.apk and app-debug-androidTest.apk. func (m *Ci) BuildAndroidDebugApks() *dagger.Directory { built := m.firebaseBase(). - WithExec([]string{"flutter", "build", "apk", "--debug", "--no-pub"}). + // `flutter build apk` spawns a Gradle daemon. When this WithExec ends the + // container is torn down and the daemon is killed, but its journal-cache + // lock file on the persistent gradle-cache volume keeps its dead PID — the + // next gradlew invocation then times out waiting for that lock. `gradlew + // --stop` shuts the daemon down gracefully so the lock is released before + // Dagger snapshots the layer. + WithExec([]string{"/bin/bash", "-c", + `flutter build apk --debug --no-pub && (cd android && ./gradlew --stop)`}). WithWorkdir("/src/android"). // --no-daemon avoids connecting to a stale daemon whose registry file was // preserved in the Dagger layer snapshot but whose process no longer exists.