Google-cloud-go: [pubsub]: rpc error: code = Unknown desc = unexpected EOF

Created on 8 Mar 2018  路  4Comments  路  Source: googleapis/google-cloud-go

Hello,

subscription.Receive() returns with error like rpc error: code = Unknown desc = unexpected EOF sometimes. I guess this is a transient error and so we re-create a client and subscription when it fails.

Now we're trying to share a pubsub client within an app as recommended, but it's hard to close the exist client and re-open it when it is shared since it would break other receiving tasks too.

Should we re-create a client in this case? Or is it sufficient to re-open a subscription with the existing client?

Thanks,

pubsub p1 question

All 4 comments

Try re-opening a subscription with an existing client.

Try re-opening a subscription with an existing client.

We're also facing the same issue. Creating a new subscription doesn't seem to be working for us. Receive call get stuck with new subscription.

@anasanzari That's a connection-level error. It does not get retried by gRPC or by client libraries (intentionally). Generally speaking, you should be able to restart the Receive. If you get an EOF and then your next Receive hangs, it _may_ be symptomatic of something odd going on in the network.

We are also seeing this issue.

We keep messages in flight (we put them on a channel in the receive loop) and Ack/Nack them appropriately downstream in our code.

If the Receive goes down then it puts us in an unrecoverable state (we cannot just restart the receive), because we also have to shutdown all the downstream processing to ensure that messages aren't processed more than once. This also makes it hard to shutdown properly because we have to keep track of all the open messages in our code to ensure everything gets Acked/Nacked on normal shutdown such that the Receive returns properly, because in this error case, Receive returns early (it doesn't wait for messages to get Acked/Nacked) and shuts down even the ability to Ack or Nack messages.

Was this page helpful?
0 / 5 - 0 ratings