# org.gradle.launcher.daemon.server.DaemonExpirationPeriodicCheck: Daemon will be stopped at the end of the build after running for 3 hours and 30 minutes of idle time

- **ID:** `cicd/gradle-daemon-stopped-build`
- **Domain:** cicd
- **Category:** system_error
- **Error Code:** `GRADLE_DAEMON_IDLE_TIMEOUT`
- **Verification:** ai_generated
- **Fix Rate:** 75%

## Root Cause

Gradle daemon was idle for too long and will be terminated, causing subsequent builds to restart a new daemon and lose cache benefits.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Gradle 7.6 | active | — | — |
| Gradle 8.0 | active | — | — |
| Gradle 8.5 | active | — | — |

## Workarounds

1. **Set a reasonable idle timeout in gradle.properties: org.gradle.daemon.idletimeout=3600000 (1 hour) and ensure CI jobs complete within that window. Also use --build-cache to persist outputs.** (85% success)
   ```
   Set a reasonable idle timeout in gradle.properties: org.gradle.daemon.idletimeout=3600000 (1 hour) and ensure CI jobs complete within that window. Also use --build-cache to persist outputs.
   ```
2. **Run 'gradle --stop' before starting a new build to force a fresh daemon, or configure CI to reuse the same daemon across steps by not exiting the JVM.** (90% success)
   ```
   Run 'gradle --stop' before starting a new build to force a fresh daemon, or configure CI to reuse the same daemon across steps by not exiting the JVM.
   ```

## Dead Ends

- **** — Simply increasing idle timeout may mask underlying memory issues or long-running CI jobs that should be optimized, and doesn't fix the root cause of long build times. (65% fail)
- **** — Disabling the daemon removes caching and warm JVM benefits, making builds significantly slower (up to 50% slower) in CI environments. (80% fail)
