Navigation Menu

Skip to content
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: closing connection due to driver.ErrBadConn hangs (locked) #29765

Closed
mtojek opened this issue Jan 16, 2019 · 6 comments
Closed
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@mtojek
Copy link

mtojek commented Jan 16, 2019

What version of Go are you using (go version)?

$ go version
go version go1.11.4 darwin/amd64

Does this issue reproduce with the latest release?

with go1.11.4 darwin/amd64

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/mtojek/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/mtojek/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/5l/8vb1435x3t90flqq1tsr_qwrpd3dc4/T/go-build439691674=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

See implementation here: https://github.com/mtojek/go-sqlmock-errbadconn/blob/master/err_bad_conn_test.go

I tried to return driver.ErrBadConn while the INSERT was executed. For ease of testing I used https://github.com/DATA-DOG/go-sqlmock .

What did you expect to see?

Test case passing.

What did you see instead?

Test case hanging.

@mtojek
Copy link
Author

mtojek commented Jan 16, 2019

/cc @kardianos

It looks familiar to the issue reported recently: #29483

@kardianos
Copy link
Contributor

Can you reproduce without SQL mock?

@kardianos kardianos added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 20, 2019
@mtojek
Copy link
Author

mtojek commented Jan 26, 2019

I tried with go-sql-driver/mysql (shutdown MySQL server), but it fails with:

[mysql] 2019/01/26 21:43:22 packets.go:36: unexpected EOF

@kardianos
Copy link
Contributor

I don't think this is a problem with database/sql. Maybe open an issue with gomock.

@agnivade agnivade added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jan 29, 2019
@mtojek
Copy link
Author

mtojek commented Jan 31, 2019

@kardianos
Don't you think it might be a similar issue to the one I linked above? Just curious...

@kardianos
Copy link
Contributor

Not really. The MySQL issue sounds like the MySQL server didn't like that sequence of commands or something and killed the connection. Unsure. It depends on how certain aspects are handled.

The deadlock on the gomock sounds like a completly different issue where it makes a different assumption that is potentially invalid. They both could be bugs. But I have no reason to believe this is a bug with database/sql. The differences in errors actually point to the issue being with the driver.

Feel free to look into the implementations and show me where I'm incorrect.

@golang golang locked and limited conversation to collaborators Feb 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants