googleapis/python-pubsublite

streaming_pull_future.cancel() hangs

Closed this issue · 2 comments

How to reproduce:

cd samples/snippets/
pip install -r requirements.txt
python subscriber_example.py $PROJECT_ID $REGION $ZONE_ID $SUBSCRIPTION_ID 60

The timeout exception is caught first, but calling cancel() on the future returned by the subscriber client next hangs:

Traceback (most recent call last):
  File "subscriber_example.py", line 74, in receive_messages
    streaming_pull_future.result(timeout=timeout)
  File "/Users/tianzi/.virtualenvs/py388/lib/python3.8/site-packages/google/cloud/pubsub_v1/futures.py", line 102, in result
    err = self.exception(timeout=timeout)
  File "/Users/tianzi/.virtualenvs/py388/lib/python3.8/site-packages/google/cloud/pubsub_v1/futures.py", line 122, in exception
    raise exceptions.TimeoutError("Timed out waiting for result.")
concurrent.futures._base.TimeoutError: Timed out waiting for result.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "subscriber_example.py", line 99, in <module>
    receive_messages(
  File "subscriber_example.py", line 76, in receive_messages
    streaming_pull_future.cancel()
  File "/Users/tianzi/.virtualenvs/py388/lib/python3.8/site-packages/google/cloud/pubsub_v1/subscriber/futures.py", line 62, in cancel
    return self._manager.close(await_msg_callbacks=await_msg_callbacks)
TypeError: close() got an unexpected keyword argument 'await_msg_callbacks'

Please see the fix in PubSub "main" client, I believe the error is caused by the StreamingPullFuture passing in the new argument, that is not supported by the PubSub Lite client's close() method? Is there anything else that the Lite client depends on that might affect it?

I presume it's also not feasible to add support for await_msg_callbacks parameter to the Lite client itself?

This issue has been resolved by rolling back the update to the pubsub library