Repository navigation
fix(build): require Go 1.27.1 to avoid database/sql deadlocks - #29692
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review — no blocking findings / technically approvable
Reviewed head 0b993bf2e60614554ba57682b110199493447731 against base dce60631f8c857ae730a4d2f328df5962e4f2a8d. No subagents and no source modifications. This is a submitted COMMENT, not a GitHub APPROVE: the authenticated account is also the PR author.
Design and complete change map
- Implementation:
go.modchanges only the minimum toolchain patch version. The synchronization owner is Go'sdatabase/sql, so consuming its released fix is preferable to adding MatrixOne locks, retries, a second cleanup path, or changing assertions/timeouts. Module requirements/replacements andgo.sumare unchanged. - Tests: zero test-source delta. The primitive-level regression belongs upstream; MatrixOne already has the integration test that exposed the failure. Reusing those tests is appropriate here; adding a timing-dependent copy to MatrixOne would add maintenance without an independent behavioral oracle.
- Documentation: BUILD.md, INSTALLATION.md and README.md synchronize the five minimum-version mentions; BUILD.md links the upstream reason. Total diff is four files, +7/-6, with no process-history design document or compatibility branch.
Verified the original upstream defect, 1.27 backport, and the released Go 1.27.1 source, not just the PR description. The invalid transition is: writer reads 0 → reader acquires → writer acquisition CAS fails → last reader leaves without notification → writer uses stale 0 to set state 1 and sleeps with no owner left to wake it. The new acquire-or-retry branch for states 0/1 prevents that transition. Setting the waiting bit now requires an actual reader state, while the mutex around notification/parking preserves the wakeup handshake. Reader reentrancy/priority and cleanup ownership are not replaced.
QA and validation
Independent local checks used actual toolchains on Darwin/arm64 and a bounded, in-memory-driver public Rows probe adapted from the upstream reproducer. The probe also checks query completion and joins cleanup on successful shutdown.
| Toolchain / scenario | Observed result |
|---|---|
| Go 1.27.0, iteration vs explicit Close | Stalled after 316 completed queries; reader and closer parked on the same closingMutex |
| Go 1.27.0, iteration vs context cancellation | Stalled after 115,520 completed queries; writer was the standard library's own Rows.awaitDone → close |
| Go 1.27.1, explicit Close and context cancellation, normal and race | All four 8-second bounded runs made progress and joined shutdown |
| Go 1.26.4 control, explicit Close | Bounded progress and joined shutdown |
| Go 1.27.1 database/sql package, normal / race | PASS, 0.364s / 1.604s |
| Go 1.27.1 TestClosingMutexLockRLockRace, race ×100 | PASS, 3.273s; measured single test 0.02s, count capped at 100 under the 30-second adaptive budget |
| Old launcher, GOTOOLCHAIN=local / go1.27.0+auto | Local rejects this module; auto selects 1.27.1 |
| Diff check and isolated checkout | PASS / clean |
These probes demonstrate the defect and bounded progress after the fix; they are not performance benchmarks or proof against unrelated deadlocks.
Reused the exact-head completed CI run, rather than rerunning the entire MatrixOne suite. UT logs identify Go 1.27.1 and show the complete TestIssue25408PreparedPaginationParameters passing in 14.27s, including the originally stuck SQL_PREPARE_ABS_preserves_numeric_peer_provenance/scientific_fractional_float_peer subcase (0.07s). The test is in pkg/tests/issues, whose CI command uses -short -tags matrixone_test -race. SCA, shared build, UT/coverage, proxy BVT, pessimistic multi-CN BVT and CI Required all passed. Shared-build logs also identify Go 1.27.1 and this commit. Skipped checks are not counted as passes.
Unhappy-path audit
| Rule | Reviewed dependency / ownership | Conclusion |
|---|---|---|
| Q1: effective cleanup owner | Rows close/context watcher/connection return remain owned by database/sql; successful probe shutdown joins the active operations | No new cleanup owner or duplicate lifecycle path |
| Q2: waits terminate | Reader/closer → closingMutex → last-reader or writer notification | Confirmed upstream lost-wakeup transition is eliminated; source analysis, old-version failures, new-version controls and race regression agree |
| Q3: growth is bounded | This diff adds no queue, retained collection, goroutine or retry store | No newly introduced accumulation mechanism |
Performance, compatibility, delivery, and comments
There is no added MatrixOne query-path lock, allocation, storage format or execution branch. The upstream fix retries a failed acquisition instead of entering the invalid wait; I am not claiming a workload-wide speedup or zero regressions from every toolchain change. Existing reader-priority starvation behavior and unrelated driver-I/O blocking are outside this fix.
I traced standard, CI, dev and BVT build consumers. The Go 1.27.0 image tags are launcher/native-cache versions, not a bypass of the module minimum: the relevant root-module builds load go.mod and select a sufficient toolchain, or reject an explicitly pinned older one. Auto-download/cache cold-start cost and offline provisioning of Go ≥1.27.1 remain deployment requirements. Existing binaries must be rebuilt; this PR does not retrofit external prebuilt clients. There is no MatrixOne persisted-data format change, and no mixed-version-upgrade requirement was imposed.
Review/thread pagination is complete: there were no existing human review findings or review threads to resolve, only the paused-review bot notice. The exact interleaving of the original #29673 CI failure remains inferred from its matching stacks, as the PR correctly says; the defect itself and both close paths were independently reproduced here.
Conclusion: appropriately scoped fix at the existing owner, with sufficient positive/negative and integration evidence. No request-changes item found.
What type of PR is this?
Which issue(s) this PR fixes:
Addresses the Go standard-library deadlock observed in #29673 CI. Upstream fix: golang/go#81043, backported in Go 1.27.1 through golang/go#81151.
What this PR does / why we need it:
Go 1.27.0's
database/sql.closingMutexcan lose a wakeup during concurrent Rows reading and closing, leaving bothRows.Errand the context-driven close permanently blocked. The failed pagination test in #29673 has matching stacks. The same fault reproduces with an unmodified official Go 1.27.0 toolchain and the upstream public Rows API reproducer, independently of MatrixOne. The exact original CI interleaving is inferred from its stacks.Require Go 1.27.1 in
go.modso builds and tests consume the upstream synchronization fix, and synchronize the existing build prerequisites. Existing CI reads its Go version fromgo.mod; existing container builds automatically select a sufficient toolchain or fail explicitly when automatic selection is disabled. Published native/base image tags remain unchanged. No application locking, SQL assertions, dependencies, or test timeouts change.This has no additional MatrixOne query-path overhead. Older build launchers may download a toolchain and miss compiler caches. Existing binaries must be rebuilt. Incorporate this patch into #29673 before rerunning its CI.
Validation on Linux amd64, Go 1.27.1:
go1.27.0+autoselects Go 1.27.1; an explicit Go 1.27.0 local toolchain rejects the module. Read-only module loading leaves dependencies andgo.sumunchanged.TestIssue25408PreparedPaginationParameters: normal PASS (24.047s); CI mode-short -tags matrixone_test -racePASS (32.098s), including the original stuck subcase.make buildPASS; generatedmo-service -versionloads and identifies Go 1.27.1.make static-check-analysisPASS with the repository-pinned molint and golangci-lint 2.14.0, built using Go 1.27.1;0 issues.gpt-6.1-sol / xhigh; no delegated agents.Remote PR CI remains pending at submission.