googleapis / google-cloud-go

Google Cloud Client Libraries for Go.
https://cloud.google.com/go/docs/reference
Apache License 2.0
3.8k stars 1.31k forks source link

pubsub: Seeing panic in the code to receive messages from pusub #10882

Open rushit83 opened 2 months ago

rushit83 commented 2 months ago

Client

e.g. PubSub

Environment

go version 1.22.4

Expected behavior

Getting message from pubsub setup on GCP

Actual behavior

panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x16f0838] goroutine 6948 [running]: cloud.google.com/go/pubsub.(pullStream).CloseSend.func1({0x0?, 0x0?}) cloud.google.com/go/pubsub@v1.38.0/pullstream.go:197 +0x18 cloud.google.com/go/pubsub.(pullStream).call(0xc002936400, 0x37143c0, {0x0, 0x0, 0xc001527e58?}) cloud.google.com/go/pubsub@v1.38.0/pullstream.go:148 +0x144 cloud.google.com/go/pubsub.(pullStream).CloseSend(0xc002936400) cloud.google.com/go/pubsub@v1.38.0/pullstream.go:196 +0x2a cloud.google.com/go/pubsub.(messageIterator).sender.func1() cloud.google.com/go/pubsub@v1.38.0/iterator.go:396 +0x25 cloud.google.com/go/pubsub.(*messageIterator).sender(0xc007852100) cloud.google.com/go/pubsub@v1.38.0/iterator.go:479 +0x854 created by cloud.google.com/go/pubsub.newMessageIterator in goroutine 6944 cloud.google.com/go/pubsub@v1.38.0/iterator.go:152 +0x552

Screenshots

NA

Additional context

NA

hongalex commented 2 months ago

Hi, I need some more information to help look into this issue:

  1. When did you start seeing this issue?
  2. Can you paste your code that shows how to reproduce this issue?

Thanks!

rushit83 commented 1 month ago

Hi @hongalex ,

Apologies for the delayed response. We started seeing this issue since September first week. Unfortunately due to IP restrictions, I can not post the code here but in nutshell it is standard go code that reads the data from a pubsub topic. On analysis we found that the panic is due to Subscriber_StreamingPullClient being null. Could there be some config or setting in GCP which might lead to this being null ?

hongalex commented 1 month ago

I see you're on v1.38.0 of the library. When you started seeing the issue in early September, was that related to a specific upgrade you did?

I also have a few more questions about how you maybe arrived at this error.

  1. Does this panic happen early into starting your subscriber application, or after a while?
  2. What is your approximate subscribe throughput (how many messages do you process a second)
  3. Can you paste your subscription.ReceiveSettings (if set)