Repository navigation
meta: make Oracle container startup fail fast instead of hanging - #18444
Conversation
The Oracle healthcheck ran sqlplus without -L and with no stdin. On a rejected logon sqlplus prompts for credentials, reads EOF and exits 0, so the container was reported healthy as soon as the binary could run, whether or not the service was reachable. The blind `sleep 30s` in start.sh was doing all of the waiting. start.sh then ran `docker exec -t ... sqlplus` without -L, so a failed logon sat at an interactive prompt on the allocated TTY and waited for input that never came. Jobs hit the 6 hour limit instead of failing. Pipe a real query into `sqlplus -L -S` in the healthcheck so it only passes on a successful logon, drop the TTY and add -L to the start.sh call, remove the sleep, and set an explicit HEALTHCHECK_TIMEOUT as dev/db2 already does. privileges.sql exits non-zero on error instead of silently continuing. Supersedes #18339. Co-Authored-By: Claude Opus 5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughOracle healthchecks now run explicit SQL queries with longer timeouts and startup grace periods. Startup scripts use bounded health waits and non-interactive SQL*Plus connections. Privilege setup now exits on SQL or operating-system errors. ChangesOracle startup reliability
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix 🚥 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 |
Pull Request Checklist
Supersedes #18339, which this replaces with an explicit healthcheck budget and full verification on both images.
Description of Changes
The healthcheck was not a healthcheck
sqlplus user/pass@servicewith no-Land no stdin prompts for credentials on a rejected logon, reads EOF, and exits 0. Measured against both real images:sqlplus …(no-L, no stdin)echo 'select 1 from dual;' | sqlplus -L -S …Identical results on
gvenzl/oracle-free:23.26.3-slimandgvenzl/oracle-xe:18-slim. The old probe only tested whether thesqlplusbinary could start, sowait-until-healthy.shreturned on the first probe every time and the blindsleep 30swas doing 100% of the actual waiting.…which is why jobs hung for six hours
start.shthen randocker exec -t … sqlpluswithout-L. On a failed logon sqlplus drops into its interactive logon prompt on the allocated TTY and waits forever:docker exec -t … sqlplusdocker exec … sqlplus -LThree jobs cited in #18339 each ran exactly 6h00m before being cancelled by the job timeout (1, 2, 3). This flake is rare — one occurrence in the 7 days to 2026-09-20, against 4 for db2 image pulls — but it is by far the most expensive per occurrence, which is the argument for fixing it.
Changes
sqlplus -L -S, so it passes only on a successful logon toXEPDB1through the listener.timeout1s → 5s, plus astart_periodso boot-time probe failures are not reported asunhealthy.start.sh(both): drop the TTY, add-L, remove the blindsleep 30s— safe now that the probe is genuine — and setHEALTHCHECK_TIMEOUT=300explicitly, matching whatdev/db2/*/start.shalready does.oldestnow uses the same easy-connect string aslatest.privileges.sql:whenever sqlerror/whenever oserrorso a failing statement exits non-zero instead of silently continuing.Verification
Run against the real images, both flavours end to end — nothing assumed from the other:
oracle-xe:18-slim(oldest)oracle-free:23.26.3-slim(latest)start.shprivileges.sqlon fresh DBORA-ORA-sequelize.authenticate()Both connect-string forms (
@XEPDB1and@localhost:1521/XEPDB1) were confirmed working on 18-slim before switchingoldestover, rather than assumed.Failure path — a service that never registers, which is the state the hung jobs were in:
wait-until-healthy.shexits 1 within the configured budget and surfacesORA-12514directly — the same error that was the last log line of the six-hour jobs, now reported instead of buried.whenever sqlerror exit failurecannot break repeat runs: neither Oracle compose file declares a volume (docker compose config --volumesis empty) andstart.shalways runsdown --remove-orphansfirst, so the DB is always fresh. Verified adown/upcycle resets it andprivileges.sqlsucceeds again. Re-running it against a live DB does now exit 1 (ORA-01920), which is the intended loud failure.There is no scenario where this is worse than today:
docker exechangs → 6hcontainer … is not runningwait-until-healthy.shcatchesexited, dumps logsList of Breaking Changes
None — development tooling only.
🤖 Generated with Claude Code
Summary by CodeRabbit