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

PubSub Subscriber fatal error "Can not recv() on an RPC that has never been open()ed" #5849

Closed
dmsolow opened this issue Aug 27, 2018 · 4 comments
Assignees
Labels
api: pubsub Issues related to the Pub/Sub API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. release blocking Required feature/issue must be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@dmsolow
Copy link

dmsolow commented Aug 27, 2018

I'm running google-cloud-pubsub 0.37.2 on python 3.6.6. This code is running on the google cloud container OS. The code runs fine for days at a time, pulling messages from PubSub and processing them, but it occasionally crashes as follows:

First I see the following logging messages:

Call to retryable <bound method BidiRpc.recv of <google.cloud.pubsub_v1.subscriber._protocol.bidi.ResumableBidiRpc object at 0x7fba5c24b908>> caused Can not recv() on an RPC that has never been open()ed..
Observed non-recoverable stream error Can not recv() on an RPC that has never been open()ed.
Not retrying <bound method BidiRpc.recv of <google.cloud.pubsub_v1.subscriber._protocol.bidi.ResumableBidiRpc object at 0x7fba5c24b908>> due to Can not recv() on an RPC that has never been open()ed..
RPC termination has signaled streaming pull manager shutdown.
Stopping consumer.

Then I see this stack trace:

Thread-ConsumeBidirectionalStream caught unexpected exception Can not recv() on an RPC that has never been open()ed. and will exit.
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/google/cloud/pubsub_v1/subscriber/_protocol/bidi.py", line 491, in _thread_main
    response = self._bidi_rpc.recv()
  File "/usr/local/lib/python3.6/site-packages/google/cloud/pubsub_v1/subscriber/_protocol/bidi.py", line 404, in recv
    super(ResumableBidiRpc, self).recv)
  File "/usr/local/lib/python3.6/site-packages/google/cloud/pubsub_v1/subscriber/_protocol/bidi.py", line 393, in _recoverable
    raise exc
  File "/usr/local/lib/python3.6/site-packages/google/cloud/pubsub_v1/subscriber/_protocol/bidi.py", line 385, in _recoverable
    return method(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/google/cloud/pubsub_v1/subscriber/_protocol/bidi.py", line 258, in recv
    'Can not recv() on an RPC that has never been open()ed.')
ValueError: Can not recv() on an RPC that has never been open()ed."   

This is followed by the following logging messages:

Thread-ConsumeBidirectionalStream exiting
Stopping scheduler.
Stopping leaser.
Thread-LeaseMaintainer exiting.
Stopping dispatcher.
Exiting the QueueCallbackWorker.
Stopping heartbeater.
Thread-Heartbeater exiting.
Finished stopping manager.

After this point the application continues to run but it receives no new PubSub messages.

Please advise.

@theacodes theacodes added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: pubsub Issues related to the Pub/Sub API. release blocking Required feature/issue must be fixed prior to next release. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Aug 27, 2018
@theacodes theacodes self-assigned this Aug 27, 2018
@theacodes
Copy link
Contributor

Alright, this is the second instance I've seen of this bug so it warrants some investigation.

You can work around this in the meantime by catching the error (returned by subscribe_future.result()) and just re-subscribing.

@crwilcox
Copy link
Contributor

@dmsolow, are there any logs leading up to this? I am curious if it shows an attempt to close the subscriber or attempts to recover.

@JustinBeckwith JustinBeckwith added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels Sep 5, 2018
@dmsolow
Copy link
Author

dmsolow commented Sep 9, 2018

@crwilcox Sorry for the delay, I was on vacation. I've attached additional CSV logs for context. The error occurs at 2018-09-02T19:06:49.088123503Z

pubsub_error.log

@theacodes
Copy link
Contributor

Thanks, @dmsolow I'm trying to reproduce this now. This one is tough, as it doesn't seem to appear very often for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. release blocking Required feature/issue must be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

4 participants