Skip to content

meta: make Oracle container startup fail fast instead of hanging - #18339

Closed
WikiRik wants to merge 2 commits into
mainfrom
meta/oracle-healthcheck-fail-fast
Closed

WikiRik wants to merge 2 commits into
mainfrom
meta/oracle-healthcheck-fail-fast

Conversation

@WikiRik

@WikiRik WikiRik commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Pull Request Checklist

  • Have you added new tests to prevent regressions? (N/A - dev tooling)
  • Does yarn test or yarn test-DIALECT pass with this change (including linting)?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)? (N/A)
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description Of Change

The oracle latest (Node 22) job on #18324 hung in yarn start-oracle-latest for the full 6 hour job limit (job). Two defects compounded:

  1. The healthcheck was a false positive. It ran sqlplus without -L and with no stdin. On a rejected logon sqlplus prompts for credentials, hits EOF and exits 0. The container flipped to healthy 12s after start, as soon as the listener answered, while the XEPDB1 PDB was not registered yet (ORA-12514). The sleep 30s in start.sh was a band-aid for exactly this.
  2. The start script's sqlplus call could block forever. It used docker exec -t without -L. When the logon failed, sqlplus dropped into its interactive logon prompt on the allocated TTY and waited for input that never came.

Changes

  • docker-compose.yml (latest + oldest): the healthcheck pipes select 1 from dual into sqlplus -L -S, so it only passes when a real logon to XEPDB1 through the listener succeeds. Timeout raised from 1s to 5s and a start_period added so boot-time probe failures are not reported as unhealthy.
  • start.sh (latest + oldest): dropped the TTY, added -L so a failed logon exits non-zero immediately, removed the blind sleep 30s. The oldest script now uses the same easy-connect string as latest.
  • privileges.sql: whenever sqlerror / whenever oserror so a failing statement exits non-zero instead of silently continuing.

Verification (local, against the real images)

Scenario Before After
Healthcheck, service not registered exit 0 exit 1
start.sh exec, service not registered hangs (killed by timeout 15) exit 1 in <1s
Re-running privileges.sql when user exists continues exit 1 (ORA-01920)
Full start, gvenzl/oracle-free:23.26.1-slim ~42s incl. sleep ~40s
Full start, gvenzl/oracle-xe:18-slim ~42s incl. sleep ~32s

🤖 Generated with Claude Code

Other affected jobs

The same mechanism also explains the oracle oldest hangs since #18291 landed: oracle oldest (Node 22) on #18292 (6h, last log line ORA-12514: TNS:listener does not currently know of service requested in connect descriptor), oracle oldest (Node 24) on #18170 (6h), and the two oracle oldest jobs on #18328 that were cancelled after 1h14m. Both flavours are fixed here.

Not covered: oracle oldest (Node 22) on #18335 died with exit code 137 (SIGKILL) while sqlplus was starting, which looks like the runner running out of memory rather than a script problem.

Related: #18340 (retry image pulls), #18341 (db2 startup timeout).

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Rik Smale and others added 2 commits September 20, 2026 09:41
The Oracle healthcheck ran sqlplus without `-L`, so a rejected logon
still exited 0 as soon as the listener was up. The container was
reported healthy before the XEPDB1 pluggable database was registered
with the listener, which the 30s sleep in start.sh papered over.

start.sh then ran sqlplus with a TTY and without `-L`. When the logon
failed with ORA-12514, sqlplus dropped into its interactive logon
prompt and waited for input forever, hanging the CI job until the
6 hour job limit (see the oracle latest Node 22 job on #18324).

- healthcheck: pipe a query into `sqlplus -L -S` so it only passes
  when a real logon to XEPDB1 through the listener succeeds; add a
  start_period so boot-time probe failures are not reported as
  unhealthy
- start.sh: drop the TTY, add `-L` so a failed logon exits non-zero
  immediately, and remove the blind 30s sleep
- privileges.sql: exit non-zero on the first SQL/OS error

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
@wikirik-agent

Copy link
Copy Markdown
Contributor

Superseded by #18444.

Same diagnosis and fix, plus two things this PR was missing:

  • an explicit HEALTHCHECK_TIMEOUT on both start scripts, so the startup budget is stated where you can see it rather than left to wait-until-healthy.sh's default two files away — matching what dev/db2/*/start.sh already does
  • verification of oldest against gvenzl/oracle-xe:18-slim end to end, including that both @XEPDB1 and @localhost:1521/XEPDB1 work there before switching it to easy-connect

Worth recording: the old probe exits 0 against a bogus service name and against wrong credentials, on both images. It was not a weak readiness check, it was only testing whether the sqlplus binary could start — which is why the sleep 30s was load-bearing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants