8000 imagestore: Fix sql resource leaks by glevand · Pull Request #3682 · rkt/rkt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

imagestore: Fix sql resource leaks #3682

Merged
merged 1 commit into from
May 19, 2017
Merged

imagestore: Fix sql resource leaks #3682

merged 1 commit into from
May 19, 2017

Conversation

glevand
Copy link
Contributor
@glevand glevand commented May 18, 2017

When using sql queries the rows iterator needs to be closed if the entire query
result is not iterated over. Failure to close the iterator results in resource
leakage.

Fixes errors like these seen with go1.8.1:

Too many goroutines running after integration test(s).
database/sql.(*Rows).awaitDone(0xc4201d9200, 0xd64000, 0xc4201e9b40)
        database/sql/sql.go:2121
created by database/sql.(*Rows).initContextClose
        database/sql/sql.go:2116

See: https://golang.org/pkg/database/sql/#Rows

When using sql queries the rows iterator needs to be closed if the entire query
result is not iterated over.  Failure to close the iterator results in resource
leakage.

Fixes errors like these seen with go1.8.1:

    Too many goroutines running after integration test(s).
    database/sql.(*Rows).awaitDone(0xc4201d9200, 0xd64000, 0xc4201e9b40)
            database/sql/sql.go:2121
    created by database/sql.(*Rows).initContextClose
            database/sql/sql.go:2116

Signed-off-by: Geoff Levand <geoff@infradead.org>
Copy link
Member
@lucab lucab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for catching and cleaning this.

@lucab lucab merged commit 047799c into rkt:master May 19, 2017
@dongsupark
Copy link

Good catch indeed. I have been seeing this error with go 1.8 too, but haven't been able to track it down.

@glevand glevand deleted the for-merge-sql branch May 19, 2017 16:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0