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

spanner: Intermittent error "Transaction was started in a different session" #8192

Closed
lc-caigwatkin opened this issue Jun 30, 2023 · 4 comments · Fixed by #8467
Closed

spanner: Intermittent error "Transaction was started in a different session" #8192

lc-caigwatkin opened this issue Jun 30, 2023 · 4 comments · Fixed by #8467
Assignees
Labels
api: spanner Issues related to the Spanner API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@lc-caigwatkin
Copy link

Client

Spanner

Environment

Cloud Run

Go Environment

go version go1.19.5, go1.20.1 to go1.20.4

Code

Seems to not be isolated to any particular piece of our code.

Here is an example of cloud.google.com/go/spanner related stack trace when we do see the error:

cloud.google.com/go/spanner.(*ReadWriteTransaction).runInTransaction
	/root/project/vendor/cloud.google.com/go/spanner/transaction.go:1505
cloud.google.com/go/spanner.(*Client).rwTransaction.func2
	/root/project/vendor/cloud.google.com/go/spanner/client.go:557
cloud.google.com/go/spanner.runWithRetryOnAbortedOrFailedInlineBeginOrSessionNotFound.func1
	/root/project/vendor/cloud.google.com/go/spanner/retry.go:92
cloud.google.com/go/spanner.runWithRetryOnAbortedOrFailedInlineBeginOrSessionNotFound
	/root/project/vendor/cloud.google.com/go/spanner/retry.go:132
cloud.google.com/go/spanner.(*Client).rwTransaction
	/root/project/vendor/cloud.google.com/go/spanner/client.go:522
cloud.google.com/go/spanner.(*Client).ReadWriteTransaction
	/root/project/vendor/cloud.google.com/go/spanner/client.go:490

Expected behavior

Transaction executes without error OR documentation includes information to understand and resolve this error.

Actual behavior

The following error occasionally pops up in our production environment across multiple databases/microservices in which query logic and database schema barely change.

spanner: code = "InvalidArgument", desc = "Transaction was started in a different session."

Screenshots

In our production environment, last 30 days, showing our error or warning logs when saw that error:

image

Additional context

We started seeing this error "Transaction was started in a different session" pop up occasionally in our production environment after upgrading to v1.44.0 in February 2023 (the first time this happened was 2023-02-12).
This appears to happen after the transaction automatically retries.
It appears to occur in our Spanner databases with higher contention, although our database usage has been higher in the past without this particular error occurring.

We cannot find any information about this new error to help us understand if this is something we can fix.
We have looked in GCP documentation as well as the client library's docs and code.
We are used to seeing and dealing with "Transaction was aborted" errors or similar, however, this new one seems different and we are still seeing those other errors.

Hoping you can help us understand what this error means.

@lc-caigwatkin lc-caigwatkin added the triage me I really want to be triaged. label Jun 30, 2023
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Jun 30, 2023
@noahdietz noahdietz added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p3 Desirable enhancement or fix. May not be included in next release. and removed triage me I really want to be triaged. labels Jul 5, 2023
@rahul2393
Copy link
Contributor

Hello @lc-caigwatkin what is the Go client library version to replicate the issue?

@lc-caigwatkin
Copy link
Author

Hello @lc-caigwatkin what is the Go client library version to replicate the issue?

Hi @rahul2393, we started seeing this error "Transaction was started in a different session" pop up occasionally in our production environment after upgrading to v1.44.0 in February 2023.

@rahul2393
Copy link
Contributor

Thanks, can you also please share the operations which you are performing inside ReadWriteTransaction

@lc-caigwatkin
Copy link
Author

Thanks for having this looked into and fixed! Did you still need any extra information? Otherwise we can keep an eye out to see that it doesn't come up again after the new version is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Spanner API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
3 participants