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

runStream returning incomplete and out of bounds for non existing values #1959

Closed
saranyasengo opened this issue Nov 23, 2023 · 13 comments · Fixed by #2000 or #1996
Closed

runStream returning incomplete and out of bounds for non existing values #1959

saranyasengo opened this issue Nov 23, 2023 · 13 comments · Fixed by #2000 or #1996
Assignees
Labels
api: spanner Issues related to the googleapis/nodejs-spanner API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@saranyasengo
Copy link

saranyasengo commented Nov 23, 2023

Environment details

  • OS: Google Container OS
  • Node.js version: 18.15
  • npm version: 9.5.0
  • @google-cloud/spanner version: 5.18.0

Steps to reproduce

This error is inconsistently happening its similar to issues #197 and #180

The code which gives error
const rowsStream = spannerDb.runStream({ sql: SELECT * FROM ${TABLE_NAME} ORDER BY storeId, started DESC, json: true, });

Error thrown as below

GoogleError: Serializing column "started" encountered an error: Integer 211959131678161148 is out of bounds. Call row.toJSON({ wrapNumbers: true }) to receive a custom type. at Int.valueOf (/opt/app/node_modules/@google-cloud/spanner/build/src/codec.js:121:19) at convertValueToJson (/opt/app/node_modules/@google-cloud/spanner/build/src/codec.js:263:22) at Object.convertFieldsToJson (/opt/app/node_modules/@google-cloud/spanner/build/src/codec.js:239:31) at Array.value (/opt/app/node_modules/@google-cloud/spanner/build/src/partial-result-stream.js:206:38) at PartialResultStream._addValue (/opt/app/node_modules/@google-cloud/spanner/build/src/partial-result-stream.js:187:34) at /opt/app/node_modules/@google-cloud/spanner/build/src/partial-result-stream.js:163:24 at Array.forEach (<anonymous>) at PartialResultStream._addChunk (/opt/app/node_modules/@google-cloud/spanner/build/src/partial-result-stream.js:162:16) at PartialResultStream._transform (/opt/app/node_modules/@google-cloud/spanner/build/src/partial-result-stream.js:85:24) at Transform._write (node:internal/streams/transform:175:8) at obj.<computed> [as _write] (/opt/app/node_modules/stubs/index.js:26:26) at doWrite (node:internal/streams/writable:411:12) at clearBuffer (node:internal/streams/writable:572:7) at onwrite (node:internal/streams/writable:464:7) at node:internal/streams/transform:190:7 at PartialResultStream._tryResume (/opt/app/node_modules/@google-cloud/spanner/build/src/partial-result-stream.js:108:13)

started column in table doesn't has the value '211959131678161148' thrown. The storeId column has this value. Looks like it swapped or wrongly mapping the values for columns. 

This error not thrown always and not reproducible in local as well.

Thanks!

@saranyasengo saranyasengo added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Nov 23, 2023
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/nodejs-spanner API. label Nov 23, 2023
@surbhigarg92 surbhigarg92 self-assigned this Dec 11, 2023
@saranyasengo
Copy link
Author

@surbhigarg92 Can we get any update on this. spanner runStream causing the issues with swapping the column values

@surbhigarg92
Copy link
Contributor

Hi @saranyasengo Sorry for the delay. I haven't been able to look into this issue. Can you please share the below information to help me reproduce this issue ?

  1. Did you start seeing this issue recently or was it always there ?
  2. Can you share the schema of your table ?
  3. What is the size of the table ?
  4. Can you try upgrading to the latest version of library and see if you are able to reproduce this issue ?

@saranyasengo
Copy link
Author

Hey @surbhigarg92

I believe the issue is from so long, but we captured recently since its thrown out of bounds error. But the actual issue is column values are swapped.

We have upgraded recently to @google-cloud/spanner version 7.0.0 still we see the values are getting swapped.

Schema of the table is secure to share. We have created google support ticket for this. I will share the table schema, sample data's with table and how the spanner runStream returns the data in support ticket.

gcf-merge-on-green bot pushed a commit that referenced this issue Feb 23, 2024
🤖 I have created a release *beep* *boop*
---


## [7.4.0](https://togithub.com/googleapis/nodejs-spanner/compare/v7.3.0...v7.4.0) (2024-02-23)


### Features

* **spanner:** Add PG.OID support ([#1948](https://togithub.com/googleapis/nodejs-spanner/issues/1948)) ([cf9df7a](https://togithub.com/googleapis/nodejs-spanner/commit/cf9df7a54c21ac995bbea9ad82c3544e4aff41b6))
* Untyped param types ([#1869](https://togithub.com/googleapis/nodejs-spanner/issues/1869)) ([6ef44c3](https://togithub.com/googleapis/nodejs-spanner/commit/6ef44c383a90bf6ae95de531c83e21d2d58da159))
* Update TransactionOptions to include new option exclude_txn_from_change_streams ([#1998](https://togithub.com/googleapis/nodejs-spanner/issues/1998)) ([937a7a1](https://togithub.com/googleapis/nodejs-spanner/commit/937a7a13f8c7660e21d34ebbaecad426b2bacd99))


### Bug Fixes

* **deps:** Update dependency google-gax to v4.3.1 ([#1995](https://togithub.com/googleapis/nodejs-spanner/issues/1995)) ([bed4832](https://togithub.com/googleapis/nodejs-spanner/commit/bed4832445e72c7116fe5495c79d989664220b38))
* Only reset pending value with resume token ([#2000](https://togithub.com/googleapis/nodejs-spanner/issues/2000)) ([f337089](https://togithub.com/googleapis/nodejs-spanner/commit/f337089567d7d92c9467e311be7d72b0a7dc8047)), closes [#1959](https://togithub.com/googleapis/nodejs-spanner/issues/1959)

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
@surbhigarg92 surbhigarg92 reopened this Feb 23, 2024
@surbhigarg92
Copy link
Contributor

@saranyasengo Can you please try using the latest release https://github.com/googleapis/nodejs-spanner/releases/tag/v7.4.0 and let us know if this resolves your issue ?

@saranyasengo
Copy link
Author

@surbhigarg92 I will update to latest version and since its not reproducible in local and its coming weekly once. I will update and monitor for couple of weeks and update on this.

Can you please share us the reproduction step to confirm before using the latest one?

@surbhigarg92
Copy link
Contributor

We found that error was happening in a particular case where the pending value were getting cleared when partialResultSet had a resume token . Please refer #2000 for the fix and test cases added.

@saranyasengo
Copy link
Author

@surbhigarg92 I have upgraded the version to 7.4.0 and now I see this issue is not coming for past 2 days, But we are facing different type of issue now, hence rollback the changes to previous one.

The specific error we are getting is Error: 3 INVALID_ARGUMENT: The code field is required for types. and I will attach the table schema and query details in the google support ticket. Please help us on fixing this.

@surbhigarg92
Copy link
Contributor

@saranyasengo The error looks like because of a recent feature which was launched #1869

I am working on fixing this. Sorry for the inconvenience.

@surbhigarg92
Copy link
Contributor

@saranyasengo As communicated earlier the error was happening because of a recent feature launch. We have reverted that feature for the time being.

Can you please try using 7.5.0 release

@saranyasengo
Copy link
Author

@surbhigarg92 We will use 7.5.0 and will monitor for somedays for fixes.

@surbhigarg92
Copy link
Contributor

@saranyasengo Let us know if this worked for you

@saranyasengo
Copy link
Author

@surbhigarg92 it works, So far we have not faced this issue.

@surbhigarg92
Copy link
Contributor

@saranyasengo We are closing this ticket. Please feel free to reopen if you face any issues.

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 googleapis/nodejs-spanner API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
2 participants