Skip to content

database.run(...) hangs for a few seconds with invalid query #2014

@ikenox

Description

@ikenox

database.run(...) hangs for a few seconds when an invalid query is passed.

Environment details

  • OS: M1 Mac
  • Node.js version: 20.7.0
  • npm version: 10.1.0
  • @google-cloud/spanner version: ^7.5.0
  • spanner emulator version: 1.5.13

Steps to reproduce

I created minimum reproducible code: https://github.com/ikenox/nodejs-spanner-example/tree/hangs-with-invalid-query

git clone git@github.com:ikenox/nodejs-spanner-example.git
git checkout hangs-with-invalid-query
pnpm install
gcloud emulators spanner start &
SPANNER_EMULATOR_HOST=localhost:9010 pnpm exec ts-node src/main.ts

main.ts executes the code like below.

  console.time('valid query');
  await database.run('select 1');
  console.timeEnd('valid query');

  console.time('invalid query');
  try{
    await database.run('select aaa');
  }catch(e){
    console.log(e);
  }
  console.timeEnd('invalid query');

And the output is below:

valid query: 21.579ms
3 INVALID_ARGUMENT: Unrecognized name: aaa [at 1:8]
select aaa
       ^
invalid query: 7.406s

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the googleapis/nodejs-spanner API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions