Skip to content

Calling subscription.pull(return_immediately=True) hangs #1441

Closed
@GilJ

Description

I've got a fairly simple PubSub setup. The subscriber tries to pull from a topic with return_immediately set to True, and performs some actions based on the data that was returned. If there was no data, the consumer waits up to 5 seconds and tries again. In pseudocode:

client = pubsub.get_client()
topic = client.get_topic()
subscription = topic.get_subscription()
while True:
    data = subscription.pull(return_immediately=True)
    if data:
        do_work(data)
    else:
        sleep(5)

I've noticed that after running this for a while, my subscriber just hangs on the subscription.pull(return_immediately=True) call. I would expect that, if a network error occurs, the connection would time out and that the function call would result in an exception.

I've tried debugging this by setting the log level of the oauth2client and oauth2client.client loggers to logging.DEBUG, but this didn't help me. I've also looked at the gcloud.connection file, but didn't find where the error might occur.

If I'm doing anything wrong, or can help solve this problem in another way, then don't hesitate to ask!

Metadata

Assignees

Labels

api: pubsubIssues related to the Pub/Sub API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions