• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stephenafamo / bob / 29180907558
48%
main: 48%

Build:
Build:
LAST BUILD BRANCH: fix/stmt-rows-leak
DEFAULT BRANCH: main
Ran 12 Jul 2026 05:25AM UTC
Jobs 2
Files 252
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 Jul 2026 05:10AM UTC coverage: 47.943% (+0.2%) from 47.707%
29180907558

Pull #737

github

sandonemaki
fix: close sql.Rows in QueryStmt to prevent connection pool leak

QueryStmt.One passed the rows from stmt.QueryContext to scan.OneFromRows,
which by contract does not close caller-owned rows, and never closed them
itself. Since One reads a single row and never exhausts the result set,
database/sql cannot auto-release the connection: every prepared One call
permanently held a pool connection until PostgreSQL rejected new ones
("sorry, too many clients already", 53300).

- One: close the rows as soon as scan.OneFromRows returns, before the
  extra loaders run (matching the non-prepared exec path); a close error
  is returned if scanning itself succeeded
- All: the happy path exhausts the rows, but a scan error mid-iteration
  leaked them — now closed explicitly on every path
- Cursor: rows ownership moves to the returned cursor, but they leaked
  when scan.CursorFromRows itself failed — now closed on that error path
- stmt_test.go: regression tests with a fake Preparer/Rows that records
  Close; all four fail without the fix

Reproduced on every released version (verified on v0.42.0 and main)
against PostgreSQL 17.
Pull Request #737: fix: close rows in QueryStmt.One to stop leaking a connection per call

6 of 12 new or added lines in 1 file covered. (50.0%)

11921 of 24865 relevant lines covered (47.94%)

727.47 hits per line

Uncovered Changes

Lines Coverage ∆ File
6
39.75
39.75% stmt.go
Jobs
ID Job ID Ran Files Coverage
1 go-oldstable - 29180907558.1 12 Jul 2026 05:25AM UTC 252
47.91
GitHub Action Run
2 go-stable - 29180907558.2 12 Jul 2026 05:28AM UTC 252
47.94
GitHub Action Run
Source Files on build 29180907558
  • Tree
  • List 252
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #737
  • PR Base - main (#29131698836)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc