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

spanner/spannertest: ping causes nil pointer dereference error #3639

Closed
olavloite opened this issue Feb 1, 2021 · 0 comments
Closed

spanner/spannertest: ping causes nil pointer dereference error #3639

olavloite opened this issue Feb 1, 2021 · 0 comments

Comments

@olavloite
Copy link
Collaborator

@olavloite olavloite commented Feb 1, 2021

The ping method in the session pool is executed without a transaction selector. This will cause a nil pointer dereference error in the ExecuteSql method of inmem.go.

https://stackoverflow.com/questions/65987211/golang-spanner-test-library-crashes-after-a-while

@olavloite olavloite self-assigned this Feb 1, 2021
@olavloite olavloite changed the title spanner/spansql: ping causes nil pointer dereference error spanner/spannertest: ping causes nil pointer dereference error Feb 1, 2021
olavloite added a commit that referenced this issue Feb 1, 2021
Normal queries from the Spanner client use the ExecuteStreamingSql method,
while DML statements use ExecuteSql. This distinction was also built into
spannertest where ExecuteSql would only support DML statements and required
a transaction to be specified. The session pool however uses ExecuteSql to
execute a simple `SELECT 1` query without specifying any transaction. This
would cause a nil pointer dereference.

This PR introduces support for queries in the ExecuteSql method. The current
logic assumes that the statement is a query if the transaction is a single-
use read-only transaction.

Fixes #3639
gcf-merge-on-green bot pushed a commit that referenced this issue Feb 4, 2021
Normal queries from the Spanner client use the ExecuteStreamingSql method,
while DML statements use ExecuteSql. This distinction was also built into
spannertest where ExecuteSql would only support DML statements and required
a transaction to be specified. The session pool however uses ExecuteSql to
execute a simple `SELECT 1` query without specifying any transaction. This
would cause a nil pointer dereference.

This PR introduces support for queries in the ExecuteSql method. The current
logic assumes that the statement is a query if the transaction is a single-
use read-only transaction.

Fixes #3639
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant