GeezerVison is showing github.com — Spanner node.js client used with GCP Functions generates errors when GCP Function is cold · Issue #2489 · googleapis/google-cloud-node
Spanner node.js client used with GCP Functions generates errors when GCP Function is cold #2489Labels api: spannerIssues related to the Spanner API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. DescriptionEnvironment details
- OS: GCP Functions
- Node.js version: GCP Functions
- npm version: 5.0.3
- google-cloud-node version: google-cloud/spanner 0.7.1
Steps to reproduce
- Deploy a GCP Function that uses the Spanner node.js client to run transactions against a Spanner database
- Invoke the function and ensure that the function correctly issues the transaction
- Wait for 10 min or so and invoke the function and an error occurs
- Immediately invoke the function again and the function correctly issues the transaction
I am initializing the JS client using these instructions i.e. no special config options:
"https://cloud.google.com/spanner/docs/getting-started/nodejs/"
The errors are:
database.run
Error: Endpoint read failed","error_code":14,"query":"SELECT
Error: Session not found: projects/REDACTED/instances/lc-data/databases/lc-data-uat/sessions/AFZejKDAPJhREDACTEDYnFRwi7iMjT0_","error_code":5,"query":"SELECT
database.runTransaction
Error: Endpoint read failed","error_code":14
connection error'" Activitystephenplusplus commented on Jul 24, 2017 I believe this is a duplicate of #2438, which I see you've posted in. I mean duplicate in the sense that a resolution to that will also resolve this. I'm going to close under that assumption, but please let me know if I'm mistaken and we will re-open. stephenplusplus commented on Jul 25, 2017 callmehiphop commented on Jul 25, 2017 We have an open issue for the Session not found (#2061). However if you're redeploying, I don't think it would use sessions from an earlier deployment.
I haven't seen any errors involving re-creating databases, could you post any error messages you get when trying to do so? vkedia commented on Jul 25, 2017 When the GCP function is invoked multiple times does it recreate the spanner client each time (specifically the instance object) or can it reuse them?
Also note that when a database is deleted all its sessions get invalidated. A general advise will be to redeploy your code in that case. added priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. on Aug 7, 2017landrito commented on Aug 7, 2017
I still get the occasional 'connection error' after the function has been cold for along time but only in a function that runs several inserts in a transaction
@vkedia Do you have an idea what could be causing this to happen? lukesneeringer commented on Aug 8, 2017 @landrito If I understand correctly from a skim, essentially the issue is that the client object is being shared between different GCF instances, but since network connections do not work that way (you can not serialize a connection and send it across the wire), you end up in a wonky state.
The fix is to either not permit client objects to be serialized and shared (like what Python does) or to ensure that the connection object is dropped on serialization and able to be reinitialized on reload. lukesneeringer commented on Oct 27, 2017 lc-chrisbarton commented on Nov 8, 2017 @stephenplusplus I have pinned to version 0.14.0 of the PubSub client library and this issue does not occur so somewhere between that version and 0.14.5 CloudFunction support has broken. BTW issue #2438/#2489 are > 3 months old and PubSub was working a month ago so this may or may not be related. stephenplusplus commented on Nov 8, 2017 Locking the issue just to make sure we funnel all useful info to one place (#2438).
MetadataMetadataapi: spannerIssues related to the Spanner API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. DevelopmentNo branches or pull requestsIssue actions
|