Spanner GO library crashes after few mins perhaps after this query (although this has been successful earlier) Version cloud.google.com/go/spanner v1.11.0
2021/02/01 00:45:32.564971 spannertest.inmem: Querying: SELECT * FROM tenant_config WHERE commit_time > "2021-02-01T00:44:32Z"
Crashinfo
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0xae3bcb]
goroutine 214 [running]:
cloud.google.com/go/spanner/spannertest.(*server).ExecuteSql(0xc00009b4a0, 0xf74c00, 0xc0001e8270, 0xc0003e8c60, 0xc00009b4a0, 0xc0001e8270, 0xc0008a4ba0)
/Users/mpathak/Development/gopkgs/pkg/mod/cloud.google.com/go/[email protected]/spannertest/inmem.go:491 +0x3b
google.golang.org/genproto/googleapis/spanner/v1._Spanner_ExecuteSql_Handler(0xd0f8a0, 0xc00009b4a0, 0xf74c00, 0xc0001e8270, 0xc00088b020, 0x0, 0xf74c00, 0xc0001e8270, 0xc0004f4060, 0x14)
/Users/mpathak/Development/gopkgs/pkg/mod/google.golang.org/[email protected]/googleapis/spanner/v1/spanner.pb.go:3581 +0x217
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0003a1500, 0xf7e800, 0xc00018a900, 0xc00089a000, 0xc0001ac2a0, 0x152c7d8, 0x0, 0x0, 0x0)
/Users/mpathak/Development/gopkgs/pkg/mod/google.golang.org/[email protected]/server.go:1194 +0x50a
google.golang.org/grpc.(*Server).handleStream(0xc0003a1500, 0xf7e800, 0xc00018a900, 0xc00089a000, 0x0)
/Users/mpathak/Development/gopkgs/pkg/mod/google.golang.org/[email protected]/server.go:1517 +0xcfd
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000606140, 0xc0003a1500, 0xf7e800, 0xc00018a900, 0xc00089a000)
/Users/mpathak/Development/gopkgs/pkg/mod/google.golang.org/[email protected]/server.go:859 +0xa1
created by google.golang.org/grpc.(*Server).serveStreams.func1
/Users/mpathak/Development/gopkgs/pkg/mod/google.golang.org/[email protected]/server.go:857 +0x204
This seems to be caused by a bug in the
ExecuteSqlmethod implementation of spannertest. The session pool of the Spanner client will execute apingstatement every 50 minutes to keep sessions alive on the backend. TheseSELECT 1statements are executed without a transaction, which means that the backend should default to a single-use read-only transaction. The inmem server of spannertest assumes that the client will always specify aTransactionSelector: https://github.com/googleapis/google-cloud-go/blob/c7ecf0f3f454606b124e52d20af2545b2c68646f/spanner/spannertest/inmem.go#L491I've opened an issue for it here: https://github.com/googleapis/google-cloud-go/issues/3639