Spanner clients hangs for a few seconds after running a query
See original GitHub issueEnvironment details
- OS: linux
- Node.js version: 10
- npm version: 7
@google-cloud/spanner
version: 5.5.0
Steps to reproduce
- Create the following javascript file in
test.js
const Spanner = require("@google-cloud/spanner").Spanner;
const projectId = "projectid";
const instance = "instance";
const database = "database";
process.env.SPANNER_EMULATOR_HOST = "localhost:9010";
const spanner = new Spanner({
projectId: projectId,
});
const spannerInstance = spanner.instance(instance);
const spannerDatabase = spannerInstance.database(database, {
acquireTimeout: 5000,
});
async function run() {
try {
console.time("run and close");
await spannerDatabase.run({
sql: `SELECT 1`,
});
await spannerDatabase.close();
console.timeEnd("run and close");
} catch (e) {
console.error("caught", e);
}
}
run();
- run
time node test.js
Output:
$ time node ./test.js
run and close: 142.309ms
real 0m5.420s
user 0m0.575s
sys 0m0.066s
As you can see it hangs after the query has run and it takes 5 seconds to finish the process.
The same without a the sql query spannerDatabase.run
will finish almost immediately.
I only tried with spanner emulator.
Thanks
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Troubleshoot Cloud Spanner deadline exceeded errors
This page provides an overview of Cloud Spanner deadline exceeded errors: what they are, why they occur, and how to troubleshoot and resolve...
Read more >Spanner: TransactionContext hangs thread indefinitely · ...
We have a loop running in one of our coorporate test VMs that updates a row for a "last checkin made by machine"...
Read more >Why am I seeing slow response times from google cloud ...
The total execution time for the second query will depend on the physical distance between your client and the Cloud Spanner instance and ......
Read more >Step-by-step guide to resolve DEADLINE_EXCEEDED errors ...
When accessing Cloud Spanner APIs, requests may fail due to “Deadline Exceeded” errors. This error indicates that a response has not been ...
Read more >Optimizing Applications, Schemas, and Query Design on ...
Cloud Spanner is a powerful product, but many users do not maximize its benefits. This talk highlights best practices, strategies for ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It should be included in 5.6.1 and higher: https://github.com/googleapis/nodejs-spanner/pull/1328
I will merge the release PR shortly. Hopefully it’ll be done by tomorrow.