-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
database/sql: prepared statements leak connections with high concurrency #5323
Labels
Comments
Ouch, this is terrible, sorry. I agree it makes any halfway-normal workload fall apart quickly and hold open connections forever. I can reproduce and have a test for it now. I started working on a fix. If I can't this into Go 1.1, I'll try to get it into the most immediate point release. Labels changed: added packagebug, removed priority-triage. Owner changed to @bradfitz. Status changed to Accepted. |
snaury, thanks again for the bug report. Mailed out https://golang.org/cl/8836045/ Could you try it out and let me know if it fixes things for you? |
This issue was closed by revision 277047f. Status changed to Fixed. |
Hey, I think I may be seeing this problem. note: I'm a newbie, so maybe I'm doing something wrong! note also: I'm using this through https://github.com/go-sql-driver/mysql but if you look at this code: https://github.com/vimeo/carbon-tagger/blob/master/carbon-tagger.go#L115 which is basically a function that creates some prepared statements and reads structs from a channel, for every struct it reads, it executes a few of the prepared statements. I was trying to find out if I should explicitly run close anywhere but I don't think so, since I want to reuse the prepared statements. also note that they are all inserts, except for one select which only returns one row so I run QueryRow on it. what I notice is that when the code runs, it generates a large amount of new connections to mysql, and when all items are processed, the amount of connections gradually drops back to 0 (!) I have db.SetMaxIdleConns(80) but that doesn't seem to do much, it goes way higher than that. before I hit it, I reach "max fd's reached" and/or "mysql error too many connections" |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: