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

Panic on CreateReadSession if ReadOptions not provided #382

Open
turb opened this issue Jan 15, 2025 · 0 comments
Open

Panic on CreateReadSession if ReadOptions not provided #382

turb opened this issue Jan 15, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@turb
Copy link

turb commented Jan 15, 2025

What happened?

When calling CreateReadSession with Java client without providing ReadOptions:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x17e2078]

goroutine 336 [running]:
github.com/goccy/bigquery-emulator/server.(*storageReadServer).CreateReadSession(0xc000a96e40, {0x30f4508, 0xc000a655c0}, 0xc000b1f130)
	/work/server/storage_handler.go:105 +0x658
cloud.google.com/go/bigquery/storage/apiv1/storagepb._BigQueryRead_CreateReadSession_Handler({0x2ce8c20?, 0xc000a96e40}, {0x30f4508, 0xc000a655c0}, 0xc000b35d80, 0x0)
	/go/pkg/mod/cloud.google.com/go/[email protected]/storage/apiv1/storagepb/storage.pb.go:3031 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000cb000, {0x30f4508, 0xc000a65530}, {0x3103500, 0xc000d404e0}, 0xc0006e5d40, 0xc000a96f00, 0x4b6be20, 0x0)
	/go/pkg/mod/google.golang.org/[email protected]/server.go:1386 +0xe23
google.golang.org/grpc.(*Server).handleStream(0xc0000cb000, {0x3103500, 0xc000d404e0}, 0xc0006e5d40)
	/go/pkg/mod/google.golang.org/[email protected]/server.go:1797 +0x100c
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	/go/pkg/mod/google.golang.org/[email protected]/server.go:1027 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 396
	/go/pkg/mod/google.golang.org/[email protected]/server.go:1038 +0x135

What did you expect to happen?

Read session created without error.

How can we reproduce it (as minimally and precisely as possible)?

CreateReadSessionRequest request = CreateReadSessionRequest
      .newBuilder()
      .setReadSession(
        ReadSession
          .newBuilder()
          .setTable(
            s"projects/${tempTable.getProject}/datasets/${tempTable.getDataset}/tables/${tempTable.getTable}",
          )
          .setDataFormat(DataFormat.AVRO)
          // prevents panic: runtime error: invalid memory address or nil pointer dereference on bigquery emulator
          //.setReadOptions(TableReadOptions.newBuilder().build())
      )
      .setParent(s"projects/${tempTable.getProject}")
      .setMaxStreamCount(1)
      .build()

readClient.createReadSession(request)

Anything else we need to know?

Workaround: provide an empty ReadOptions (as commented out in example code).

@turb turb added the bug Something isn't working label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant