Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(31)

Issue 14642044: code review 14642044: database/sql: Fix connection leaks and numOpen count (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 6 months ago by Hierro
Modified:
10 years, 6 months ago
Reviewers:
bradfitz
CC:
golang-dev, bradfitz, dfc
Visibility:
Public.

Description

database/sql: Fix connection leaks and numOpen count Add a check at the end of every test to make sure there are no leaked connections after running a test. Avoid incorrectly decrementing the number of open connections when the driver connection ends up it a bad state (numOpen was decremented twice). Prevent leaking a Rows struct (which ends up leaking a connection) in Row.Scan() when a *RawBytes destination is used. Close the Rows struct in TestRowsColumns.

Patch Set 1 #

Patch Set 2 : diff -r a10c7a350ab5 https://code.google.com/p/go #

Patch Set 3 : diff -r a10c7a350ab5 https://code.google.com/p/go #

Patch Set 4 : diff -r 9d0d95344a6c https://code.google.com/p/go #

Total comments: 2

Patch Set 5 : diff -r 9d0d95344a6c https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+18 lines, -5 lines) Patch
M src/pkg/database/sql/sql.go View 1 2 3 4 4 chunks +9 lines, -5 lines 0 comments Download
M src/pkg/database/sql/sql_test.go View 1 2 3 4 2 chunks +9 lines, -0 lines 0 comments Download

Messages

Total messages: 8
Hierro
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
10 years, 6 months ago (2013-10-15 23:01:07 UTC) #1
bradfitz
Is this related to your previous CL at all? There is no bug number in ...
10 years, 6 months ago (2013-10-15 23:47:13 UTC) #2
bradfitz
There is a data race with this fix. === RUN TestStmtCloseOrder ================== WARNING: DATA RACE ...
10 years, 6 months ago (2013-10-16 00:12:20 UTC) #3
Hierro
Hi Brad, Nice catch. I didn't realize the tests used the DB concurrently, so I ...
10 years, 6 months ago (2013-10-16 00:58:06 UTC) #4
dfc
https://codereview.appspot.com/14642044/diff/12001/src/pkg/database/sql/sql_test.go File src/pkg/database/sql/sql_test.go (right): https://codereview.appspot.com/14642044/diff/12001/src/pkg/database/sql/sql_test.go#newcode93 src/pkg/database/sql/sql_test.go:93: err := db.Close() if err := ... ; err ...
10 years, 6 months ago (2013-10-16 01:28:01 UTC) #5
Hierro
On 2013/10/16 01:28:01, dfc wrote: > https://codereview.appspot.com/14642044/diff/12001/src/pkg/database/sql/sql_test.go > File src/pkg/database/sql/sql_test.go (right): > > https://codereview.appspot.com/14642044/diff/12001/src/pkg/database/sql/sql_test.go#newcode93 > ...
10 years, 6 months ago (2013-10-16 11:53:20 UTC) #6
bradfitz
LGTM Thanks!
10 years, 6 months ago (2013-10-16 16:09:35 UTC) #7
bradfitz
10 years, 6 months ago (2013-10-16 16:17:37 UTC) #8
*** Submitted as https://code.google.com/p/go/source/detail?r=bafb49a30d5f ***

database/sql: fix double decrement of numOpen count; test for connection leaks

Add a check at the end of every test to make sure
there are no leaked connections after running a test.

Avoid incorrectly decrementing the number of open connections
when the driver connection ends up it a bad state (numOpen was
decremented twice).

Prevent leaking a Rows struct (which ends up leaking a
connection) in Row.Scan() when a *RawBytes destination is
improperly used.

Close the Rows struct in TestRowsColumns.

Update issue 6593

R=golang-dev, bradfitz, dave
CC=golang-dev
https://codereview.appspot.com/14642044

Committer: Brad Fitzpatrick <bradfitz@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b