google-cloud-go icon indicating copy to clipboard operation
google-cloud-go copied to clipboard

spanner: session recycling issue

Open egonelbre opened this issue 1 month ago • 3 comments

We started seeing some session recycling issues in our testsuite, such as:

    min_opened_test.go:169: iteration 47: spanner: code = "InvalidArgument", desc = "Previously received a different request with this seqno. seqno=2\nRequested SQL: UPDATE TestTable SET value = @p1 WHERE id = @p2", requestID = "1.7d54f73a39f6a241.1.2.105.1"
@p2", requestID = "1.4bfbb6c68426906c.1.4.10.1"

    min_opened_test.go:111:   goroutine 2 iteration 0: spanner: code = "FailedPrecondition", desc = "Cannot read or query using a transaction after it has been committed or rolledback.", requestID = "1.4bfbb6c68426906c.1.3.118.1"

I synthesized regression tests with ai, which are here https://github.com/googleapis/google-cloud-go/pull/13436. It seems important that the tests are run in parallel and together.

It seems that go-sql-spanner testsuite has been seeing similar issues e.g. https://github.com/googleapis/go-sql-spanner/issues/626 and https://github.com/googleapis/go-sql-spanner/issues/608.

I'm still trying to find the underlying cause for the issue. It could be that it's just a spanner emulator bug.

egonelbre avatar Dec 02 '25 12:12 egonelbre

The issue does not seem to happen with GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS=false.

egonelbre avatar Dec 02 '25 14:12 egonelbre

Only setting GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_FOR_RW=false also seems to help.

egonelbre avatar Dec 03 '25 12:12 egonelbre

Yes the check on seqno is only for multiplex sessions, I am investigating why Go in-memory emulator returns this error

rahul2393 avatar Dec 03 '25 19:12 rahul2393