googleapis / googleapis/ruby-spanner
execute_sql hangs forever until you call .rows on the results
- Dominant language
- Ruby
- Stars
- 6
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
#### Problem
When calling `execute_sql` the program hangs forever (I had to kill -9 it) unless you read from .rows.
#### Environment details
- OS: MacOS
- Ruby version: 3.4.2
- Gem name and version: google-cloud-spanner 2.26
#### Steps to reproduce
1. Create a client
2. `client.execute_sql`
3. Never read the result from `execute_sql`
4. Program hangs forever
#### Code example
```ruby
require "google/cloud/spanner"
puts "Starting"
emulator_host = ENV.fetch("SPANNER_EMULATOR_HOST", nil)
project_id = ENV.fetch("SPANNER_EMULATOR_PROJECT", "")
instance_id = ENV.fetch("SPANNER_EMULATOR_INSTANCE", "")
database_id = ENV.fetch("SPANNER_EMULATOR_DATABASE", "")
puts "Creating project"
project = Google::Cloud::Spanner.new(
project_id: project_id,
emulator_host: emulator_host,
)
puts "Creating client"
client = project.client(instance_id, database_id)
puts "Executing sql"
puts client.execute_sql("SELECT * FROM my_table")
```
Change the last line to:
`puts client.execute_sql("SELECT * FROM my_table").rows.first`
And it will no longer hang.
#### Full backtrace
There is no backtrace, the program just hangs forever after printing "Executing sql"
Contributor guide
Assessment
This issue has not been assessed yet.