Skip to content

spanner: nil reference if a transaction is retried due to a Session not found error #10385

@olavloite

Description

@olavloite
--- FAIL: TestEmptyQueryAbortedTwice (0.01s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xf04b1a]

goroutine 11 [running]:
testing.tRunner.func1.2({0x114ed80, 0x1f20880})
	/opt/hostedtoolcache/go/1.20.14/x64/src/testing/testing.go:1526 +0x24e
testing.tRunner.func1()
	/opt/hostedtoolcache/go/1.20.14/x64/src/testing/testing.go:1529 +0x39f
panic({0x114ed80, 0x1f20880})
	/opt/hostedtoolcache/go/1.20.14/x64/src/runtime/panic.go:884 +0x213
cloud.google.com/go/spanner.(*sessionPool).take(0x0, {0x1532e08, 0xc00012e000})
	/home/runner/go/pkg/mod/cloud.google.com/go/spanner@v1.63.0/session.go:1040 +0x9a
cloud.google.com/go/spanner.(*ReadWriteTransaction).begin(0xc0005a2f00, {0x1532e08, 0xc00012e000})
	/home/runner/go/pkg/mod/cloud.google.com/go/spanner@v1.63.0/transaction.go:1501 +0x346
cloud.google.com/go/spanner.NewReadWriteStmtBasedTransactionWithOptions({0x1532e08, 0xc00012e000}, 0xc000b419e0, {{0x0, 0x0}, {0x0, 0x0}, 0x0, 0x0, 0x0})
	/home/runner/go/pkg/mod/cloud.google.com/go/spanner@v1.63.0/transaction.go:1757 +0x385
github.com/googleapis/go-sql-spanner.(*conn).BeginTx(0xc001e331e0, {0x1532e08?, 0xc00012e000}, {0xc001419928?, 0x3d?})
	/home/runner/work/go-sql-spanner/go-sql-spanner/driver.go:976 +0x4fb
database/sql.ctxDriverBegin({0x1532e08, 0xc00012e000}, 0xc001419cb0, {0x1530fd0, 0xc001e331e0})
	/opt/hostedtoolcache/go/1.20.14/x64/src/database/sql/ctxutil.go:104 +0x7b
database/sql.(*DB).beginDC.func1()
	/opt/hostedtoolcache/go/1.20.14/x64/src/database/sql/sql.go:1868 +0xc5
database/sql.withLock({0x152e318, 0xc0000b2090}, 0xc001419a38)
	/opt/hostedtoolcache/go/1.20.14/x64/src/database/sql/sql.go:3405 +0x8c
database/sql.(*DB).beginDC(0xc004577ee0, {0x1532e08, 0xc00012e000}, 0xc0000b2090, 0xc00059cf20, 0xc001419b08?)
	/opt/hostedtoolcache/go/1.20.14/x64/src/database/sql/sql.go:1864 +0xcf
database/sql.(*DB).begin(0x0?, {0x1532e08, 0xc00012e000}, 0xf973a0?, 0x10?)
	/opt/hostedtoolcache/go/1.20.14/x64/src/database/sql/sql.go:1857 +0x94
database/sql.(*DB).BeginTx.func1(0x8a?)
	/opt/hostedtoolcache/go/1.20.14/x64/src/database/sql/sql.go:1836 +0x45
database/sql.(*DB).retry(0x1523a00?, 0xc001419b90)
	/opt/hostedtoolcache/go/1.20.14/x64/src/database/sql/sql.go:1538 +0x[47](https://github.com/googleapis/go-sql-spanner/actions/runs/9548744099/job/26316634938?pr=256#step:4:48)
database/sql.(*DB).BeginTx(0x1540e88?, {0x1532e08?, 0xc00012e000?}, 0x456a08?)
	/opt/hostedtoolcache/go/1.20.14/x64/src/database/sql/sql.go:1835 +0x8a
github.com/googleapis/go-sql-spanner.testRetryReadWriteTransactionWithQuery(0xc000[50](https://github.com/googleapis/go-sql-spanner/actions/runs/9548744099/job/26316634938?pr=256#step:4:51)3a00, 0x13fcfb0, 0x0, 0xffffffffffffffff, 0x3, 0x1, 0x0, {0x0?, 0x0})
	/home/runner/work/go-sql-spanner/go-sql-spanner/aborted_transactions_test.go:369 +0x132
github.com/googleapis/go-sql-spanner.testRetryReadWriteTransactionWithQueryWithRetrySuccess(...)
	/home/runner/work/go-sql-spanner/go-sql-spanner/aborted_transactions_test.go:350
github.com/googleapis/go-sql-spanner.TestEmptyQueryAbortedTwice(0xc000503380?)
	/home/runner/work/go-sql-spanner/go-sql-spanner/aborted_transactions_test.go:169 +0x3d
testing.tRunner(0xc000503a00, 0x13fcfb8)
	/opt/hostedtoolcache/go/1.20.14/x64/src/testing/testing.go:1[57](https://github.com/googleapis/go-sql-spanner/actions/runs/9548744099/job/26316634938?pr=256#step:4:58)6 +0x10b
created by testing.(*T).Run
	/opt/hostedtoolcache/go/1.20.14/x64/src/testing/testing.go:1629 +0x3ea
exit status 2
FAIL	github.com/googleapis/go-sql-spanner	0.373s
Error: Process completed with exit code 1.

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the Spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions