Repository navigation
meta: give Db2 containers enough time to initialize before giving up - #18341
Conversation
db2 oldest/latest jobs fail regularly in `yarn start-db2-*` with "Timeout of 150s exceeded when waiting for container to be healthy". Db2 creates the database on first start, and successful runs of the same step on main take 127-213s, so the 150s budget of the Db2-only copy of wait-until-healthy.sh is right at the edge of normal. Locally, on a fast machine, the container first reports healthy after 175s. That copy also predates #18291: it still has the dead `return_code` check, prints nothing about the container on failure, and sleeps a blind 15s after the container is healthy. Remove it and use the shared dev/wait-until-healthy.sh, which supports HEALTHCHECK_TIMEOUT and dumps the health probes and container logs when it gives up. Db2 gets a 600s budget so a slow runner has headroom while a genuinely stuck container still fails in minutes rather than hours. The setup script restarts the instance twice after creating the database, so a probe can pass in a short window before a restart. The healthcheck now also requires the image's own setup-complete marker, which is created after the last restart. This replaces the blind 15s sleep. start_period goes to 300s so the container is not reported unhealthy while it is legitimately still creating the database. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (5)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe DB2 healthchecks now wait for setup completion and allow 300 seconds for startup. Both DB2 startup scripts use a 600-second timeout and call the repository-level health wait script. The DB2-specific wait script was removed. ChangesDB2 health readiness
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to DB2 startup now waits for setup completion and allows more time for health checks, reducing premature CI failures without an identified current-head merge risk. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Pull Request Checklist
yarn testoryarn test-DIALECTpass with this change (including linting)?Description Of Change
Since #18291 landed,
db2 oldestanddb2 latestare the most frequent database start failures in CI: 15 failedyarn start-db2-*steps across 9 runs, all withExamples: db2 oldest (Node 22), db2 latest (Node 24).
Cause
Db2 creates the database on first start. The start step on successful main runs takes 127-213s, and locally on a fast machine the container first reports healthy after 175s. The Db2-only copy of
wait-until-healthy.shpolls for 10 × 15s = 150s, which is right at the edge of a normal startup, so a slightly slow runner fails.That copy also predates #18291: it still has the dead
return_codecheck, prints nothing about the container on failure (which is why the job logs above say nothing useful), and sleeps a blind 15s after the container is healthy.There is a second, latent problem. The image's setup script restarts the instance twice right after
CREATE DATABASE:A probe landing in one of those ~6s windows marks the container healthy, after which the instance goes down again and
check-connection.tsgetsECONNREFUSED. The oldsleep 15was presumably guarding against this.Changes
dev/db2/wait-until-healthy.sh; bothstart.shuse the shareddev/wait-until-healthy.shwithHEALTHCHECK_TIMEOUT=600, so a slow runner has headroom while a genuinely stuck container still fails in minutes rather than hours, and the health probes + container logs are dumped on failure./database/config/.shared-data/setup_complete, the marker the image'ssetup_db2_instance.shtouches right after the last restart (same path in 11.5.5.1 and 12.1.4.0). This replaces the blind sleep.start_period: 300sso the container is not reportedunhealthywhile it is legitimately still creating the database.Verification (local,
icr.io/db2_community/db2:11.5.5.1)Note: touches the same
start.shfiles as #18340, expect a trivial conflict in whichever lands last.🤖 Generated with Claude Code
Summary by CodeRabbit