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: transaction leak #27434

Closed
nzlov opened this issue Sep 1, 2018 · 3 comments
Closed

database/sql: transaction leak #27434

nzlov opened this issue Sep 1, 2018 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@nzlov
Copy link

nzlov commented Sep 1, 2018

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

go version go1.11 darwin/amd64

postgresql 10.5-1.pgdg90+1 in docker

// postgres.conf
max_connections = 1000                  # (change requires restart)
idle_in_transaction_session_timeout = 5000      # in milliseconds, 0 is disabled

Does this issue reproduce with the latest release?

yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/nzlov/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/nzlov/workspace/go"
GOPROXY=""
GORACE=""
GOROOT="/Users/nzlov/program/go"
GOTMPDIR=""
GOTOOLDIR="/Users/nzlov/program/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/_9/6616bz990gb21ds_kw9tv1x40000gn/T/go-build672159973=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Sorry.I don't know. Use revel v0.13.1 and gorm. Maybe #22976.

What did you expect to see?

Rollback the transaction

What did you see instead?

The transaction hangs up and massive db lock wait timeouts

No Commit Error.
No Rollback Error.

debug/pprof

55 @ 0x42dd8b 0x42de33 0x405a5e 0x40574b 0x6e6d4b 0x45bb71
#	0x6e6d4a	database/sql.(*Tx).awaitDone+0x4a	/Users/nzlov/program/go/src/database/sql/sql.go:1914

2 @ 0x42dd8b 0x43dd6d 0x6e1c18 0x45bb71
#	0x6e1c17	database/sql.(*DB).connectionOpener+0xe7	/Users/nzlov/program/go/src/database/sql/sql.go:1001

2 @ 0x42dd8b 0x43dd6d 0x6e1d4b 0x45bb71
#	0x6e1d4a	database/sql.(*DB).connectionResetter+0xfa	/Users/nzlov/program/go/src/database/sql/sql.go:1014

postgres in docker


999 | 5880 | 5858 | 0 | 09:58 | ? | 00:00:01 | postgres
-- | -- | -- | -- | -- | -- | -- | --
999 | 6021 | 5880 | 0 | 09:58 | ? | 00:00:01 | postgres: checkpointer process
999 | 6022 | 5880 | 0 | 09:58 | ? | 00:00:00 | postgres: writer process
999 | 6023 | 5880 | 0 | 09:58 | ? | 00:00:02 | postgres: wal writer process
999 | 6024 | 5880 | 0 | 09:58 | ? | 00:00:00 | postgres: autovacuum launcher process
999 | 6025 | 5880 | 0 | 09:58 | ? | 00:00:02 | postgres: stats collector process
999 | 6026 | 5880 | 0 | 09:58 | ? | 00:00:00 | postgres: bgworker: logical replication launcher
999 | 6167 | 5880 | 0 | 10:00 | ? | 00:00:06 | postgres: postgres shanshou 172.18.0.7(40332) idle
999 | 6556 | 5880 | 0 | 10:06 | ? | 00:00:00 | postgres: postgres shanshou 192.168.1.200(57254) idle
999 | 6557 | 5880 | 0 | 10:06 | ? | 00:00:00 | postgres: postgres shanshou 192.168.1.200(57255) idle
999 | 8926 | 5880 | 0 | 10:30 | ? | 00:00:00 | postgres: postgres shanshou 192.168.1.146(51001) idle
999 | 8927 | 5880 | 0 | 10:30 | ? | 00:00:00 | postgres: postgres shanshou 192.168.1.146(51002) idle
999 | 8944 | 5880 | 0 | 10:31 | ? | 00:00:00 | postgres: postgres shanshou 192.168.1.146(51019) idle
999 | 9666 | 5880 | 0 | 10:39 | ? | 00:00:03 | postgres: postgres shanshou 172.18.0.7(47046) idle
999 | 9718 | 5880 | 0 | 10:39 | ? | 00:00:00 | postgres: postgres shanshou 192.168.1.200(53736) idle
999 | 11696 | 5880 | 0 | 10:59 | ? | 00:00:11 | postgres: postgres shanshou 172.18.0.10(42800) idle
999 | 11715 | 5880 | 0 | 10:59 | ? | 00:00:11 | postgres: postgres shanshou 172.18.0.10(42836) idle
999 | 14587 | 5880 | 0 | 11:13 | ? | 00:00:00 | postgres: postgres shanshoulog 172.18.0.13(37358) idle
999 | 16079 | 5880 | 0 | 11:32 | ? | 00:00:00 | postgres: postgres shanshou 172.18.0.4(45886) idle
999 | 16081 | 5880 | 0 | 11:32 | ? | 00:00:00 | postgres: postgres shanshoulog 172.18.0.4(45888) idle
999 | 17133 | 5880 | 0 | 11:46 | ? | 00:00:00 | postgres: postgres shanshou 172.18.0.13(41586) idle
999 | 17178 | 5880 | 0 | 11:46 | ? | 00:00:00 | postgres: postgres shanshou 172.18.0.13(41634) idle


@kardianos
Copy link
Contributor

I'll look into it.

@kardianos kardianos added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 2, 2018
@kardianos
Copy link
Contributor

What postgres database driver package and version are you using?

@kardianos kardianos added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Sep 19, 2018
@kardianos
Copy link
Contributor

I don't think there is sufficient information here to work from.

I'll need:

  • The postgresql Go driver package and version you are using.
  • A sample code, or description of the code that duplicates this issue. If filed on the golang issue tracker, it would be best to not require the gorm dependency.

Feel free to ping this same issue with details and I'll re-open.

@golang golang locked and limited conversation to collaborators Sep 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants