question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spanner clients hangs for a few seconds after running a query

See original GitHub issue

Environment details

  • OS: linux
  • Node.js version: 10
  • npm version: 7
  • @google-cloud/spanner version: 5.5.0

Steps to reproduce

  1. 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();
  1. 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:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
olavloitecommented, Mar 30, 2021

Is that going to be released with version 5.7 ? When can we expect it to be bumped?

It should be included in 5.6.1 and higher: https://github.com/googleapis/nodejs-spanner/pull/1328

0reactions
skuruppucommented, Mar 31, 2021

I will merge the release PR shortly. Hopefully it’ll be done by tomorrow.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found