You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an exception occurs in the callback, the subscriber will hang indefinitely in some cases (about 1 in 5). It seems the queue returns None instead of queue.Empty here:
This happens both with await_callbacks_on_shutdown=True and await_callbacks_on_shutdown=False.
Code example
fromconcurrent.futuresimportTimeoutErrorfromgoogle.cloud.pubsubimportSubscriberClientproject_id="your-project-id"subscription_id="your-subscription-id"subscriber=SubscriberClient()
subscription_path=subscriber.subscription_path(project_id, subscription_id)
defcallback(message):
raiseException()
message.ack()
streaming_pull_future=subscriber.subscribe(subscription_path, callback=callback)
print(f"Listening for messages on {subscription_path}..\n")
withsubscriber:
try:
streaming_pull_future.result()
exceptTimeoutError:
streaming_pull_future.cancel()
Stack trace
Exception in thread Thread-OnRpcTerminated:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/site-packages/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py", line 569, in _shutdown
dropped_messages = self._scheduler.shutdown(
File "/usr/local/lib/python3.8/site-packages/google/cloud/pubsub_v1/subscriber/scheduler.py", line 145, in shutdown
dropped_messages.append(work_item.args[0])
AttributeError: 'NoneType' object has no attribute 'args'
Environment details
google-cloud-pubsubversion: 2.4.1Steps to reproduce
When an exception occurs in the callback, the subscriber will hang indefinitely in some cases (about 1 in 5). It seems the queue returns
Noneinstead ofqueue.Emptyhere:python-pubsub/google/cloud/pubsub_v1/subscriber/scheduler.py
Lines 142 to 147 in 5812018
This happens both with
await_callbacks_on_shutdown=Trueandawait_callbacks_on_shutdown=False.Code example
Stack trace