Skip to content

CI: stop the macOS PostgreSQL E2E from hanging until the job is cancelled - #69

Merged
doron050 merged 4 commits into
mainfrom
ci/macos-e2e-hang
Nov 27, 2026
Merged

doron050 merged 4 commits into
mainfrom
ci/macos-e2e-hang

Conversation

@doron050

Copy link
Copy Markdown
Contributor

Summary

Build / Cross-platform / End-to-End (macOS, Ruby 3.1) and (macOS, Ruby 4.0) were cancelled after 10 minutes on main (run 45807447973, commit c46b4a5). Only the macOS PostgreSQL step stalls; SQLite, MySQL, Windows and the Linux suites are green.

What I found

  • Not the gem bump in Bump the gems group across 1 directory with 3 updates #67: it only changes Gemfile.lock, which the Ruby 3.1 job does not use (it resolves Gemfile.e2e fresh), and the Linux PostgreSQL E2E passes on the same commit.
  • The previous run (3e6cef7) passed on the same runner image (macos-26-arm64/20261117.0516), PostgreSQL 16.16, pg 1.7.0, connection_pool 2.5.5, minitest 5.27.0. The PostgreSQL step took 13 s there.
  • The two jobs stopped at different tests (reconstructed from the seeds and the truncate cascades notices: test_execlastid_returns_the_returning_column with seed 30761, test_a_statement_left_prepared_by_a_failed_prepare_is_used with seed 30783), each right after a test's setup started its TRUNCATEs. So it is a nondeterministic stall, not one broken test. An earlier Build run on fc4f6ac also ended as failure with only cancelled jobs.

The root cause is not proven (I could not reproduce it on macOS). This PR removes the likely cause and makes any recurrence diagnosable:

  • Turns off fsync, synchronous_commit and full_page_writes on the CI database. The tests need no durability, and TRUNCATE is fsync-heavy (the probable cause: a stalled flush on a macOS runner).
  • Adds tests/hang_watchdog.rb, required by the PostgreSQL, MySQL and SQLite suites. A test running longer than E2E_TEST_TIMEOUT seconds (default 120; the slowest real test takes a few seconds) prints the test, every thread's backtrace and, for PostgreSQL, the server's sessions and ungranted locks, then exits 1.
  • Gives each cross-platform E2E step its own timeout-minutes, so a stall fails its own step with output instead of the job being cancelled.
  • Documents it in docs/Testing.md.

No generated code or plugin code changes.

Checklist

  • examples/ is regenerated (rake sqlc_generate_process) and committed: not applicable, generated output unchanged
  • Tests added or updated: unit and golden tests pass (113 runs, 0 failures). The watchdog was checked with a synthetic hanging test (it reports and exits 1) and a normal run (no effect). All changed Ruby files pass ruby -wc. The PostgreSQL, MySQL and SQLite E2E suites were not run here (no databases in this container), so this PR's own CI is the real test.
  • The generated code stays RuboCop-clean and Steep-clean: not applicable, generated code unchanged
  • Labelled so the release notes are grouped correctly

If the macOS jobs still stall after this, the watchdog output will name the test and show what PostgreSQL is waiting on.


Generated by Claude Code

…lled

Both macOS E2E jobs on c46b4a5 stalled inside the PostgreSQL suite (right after a
test's setup began its TRUNCATEs) and were cancelled after 10 minutes. The same
suite passes in 13 s on the same runner image, PostgreSQL and gem versions, so
this is a nondeterministic stall, not a regression of the gem bump.

* turn off fsync / synchronous_commit / full_page_writes on the CI database: the
  tests need no durability and TRUNCATE is fsync-heavy (the probable cause)
* tests/hang_watchdog.rb: a test running longer than E2E_TEST_TIMEOUT (120 s)
  prints its thread backtraces and the PostgreSQL sessions / ungranted locks,
  then exits 1, so a hang fails with a diagnosis
* a timeout-minutes per E2E step, so a stall fails its own step instead of the
  job being cancelled
* docs/Testing.md describes the watchdog

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FskpZCiq2EczacwHZtE6Uo
@doron050 doron050 added the bug Something isn't working label Nov 26, 2026 — with Claude
…produces

Runs the suite 4 x 20 times on macOS with the old settings and 4 x 20 with the
tuned ones. Deleted again before the PR is merged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FskpZCiq2EczacwHZtE6Uo
…eSQL tuning

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FskpZCiq2EczacwHZtE6Uo
They ran the macOS PostgreSQL suite 160 times and the real macOS E2E job 12
times with and without the PostgreSQL tuning; nothing reproduced the hang.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FskpZCiq2EczacwHZtE6Uo
@doron050
doron050 merged commit 422a398 into main Nov 27, 2026
42 checks passed
@doron050
doron050 deleted the ci/macos-e2e-hang branch November 27, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants