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: Session not found on Read with KeySet #2718

Closed
ericwenn opened this issue Aug 11, 2020 · 4 comments · Fixed by #2724
Closed

spanner: Session not found on Read with KeySet #2718

ericwenn opened this issue Aug 11, 2020 · 4 comments · Fixed by #2724
Assignees
Labels
api: spanner Issues related to the Spanner API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@ericwenn
Copy link

Client

Spanner (v1.7.0)

Environment

Cloud Run (fully managed)

Code

keySet := spanner.KeySets(
	spanner.Key{ /* ... */ },
	spanner.Key{ /* ... */ },
	spanner.Key{ /* ... */ }
)
err = spannerClient.Single().Read(
	ctx,
	/* ... */,
	keySet,
	/* ... */,
).Do(/* ... */)

Expected behavior

Request should succeed, and the client handles maintaining the session pool.

Actual behavior

Intermittent failure, client returns:

code = "NotFound", desc = "Session not found: projects/xxx/instances/xxx/databases/xxx/sessions/AN4G3x93_EfsUJcOlBpnvbOmZELeqImNJjvJv2UiEX5r0rvMzqTU1Juhug7qOA"

Additional context
Re-running the same request succeeds but sometimes, very seldom, the error is returned.
There are many Read() calls being made by our service concurrently in the call-chain, and when the error occurs it is only for one of the calls.

@ericwenn ericwenn added the triage me I really want to be triaged. label Aug 11, 2020
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Spanner API. label Aug 11, 2020
@skuruppu skuruppu added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed triage me I really want to be triaged. labels Aug 12, 2020
@skuruppu
Copy link
Contributor

@olavloite, would you please be able to take a look at this one?

CC @hengfengli

@skuruppu skuruppu assigned olavloite and unassigned skuruppu Aug 12, 2020
olavloite added a commit that referenced this issue Aug 12, 2020
`Session not found` errors were not retried for read operations on a
single-use read-only transaction.

Fixes #2718
@ericwenn
Copy link
Author

@olavloite thanks for quick fix.

Have some more context in case you need it:

  • Issue is not related to using KeySet as the title of this issue indicates. We've seen the same issue when using KeyRanges as well.
  • We are using the default Spanner config with not tuning of the parameters.

@olavloite
Copy link
Contributor

@ericwenn
Thanks for the additional information. I've been able to confirm and reproduce the issue, and as you noted, it can occur regardless of whether you use a KeySet or KeyRange. We added automatic retries for Session not found earlier in the client library for most methods, but the Read method on a single-use read-only transaction was not included in that fix. That also explains why you are only experiencing this error on this specific method occasionally.

olavloite added a commit that referenced this issue Aug 14, 2020
* fix(spanner): retry session not found for read

`Session not found` errors were not retried for read operations on a
single-use read-only transaction.

Fixes #2718

* fix: rename method to satisfy lint check

* fix: remove unused variable
@ericwenn
Copy link
Author

Thanks for quick triage and turnaround! Looking forward to bumping our service to next release 🚀

tritone pushed a commit to tritone/google-cloud-go that referenced this issue Aug 25, 2020
* fix(spanner): retry session not found for read

`Session not found` errors were not retried for read operations on a
single-use read-only transaction.

Fixes googleapis#2718

* fix: rename method to satisfy lint check

* fix: remove unused variable
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: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants