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
Create a google.cloud.pubsub_v1.PublisherClient instance and call the publish method with timeout="some_string" or retry="some_string" (causes error in batch thread) and then call the result() method on the returned future.
Expect pubsub to fail fast and hard with an appropriate error in the main thread, instead it proceeds without complaining, which causes an uncaught exception in the batch thread, which causes the main thread to hang.
Code example
Start a pubsub emulator locally, create the below topic and set the PUBSUB_EMULATOR_HOST variable to point to it. Then:
The script prints the below strack trace and hangs (indefinitely?), blocking in future.result().
While adding some sanity checks on the arguments to publish() would fix this particular instance of the problem, the fundamental problem here appears to be that there's no catch-all try-except in the batch thread ensuring that it will always terminate gracefully.
Stack trace
The uncaught error in the batch thread is caught and printed to stderr by code in the threading module:
Exception in thread Thread-CommitBatchPublisher:
Traceback (most recent call last):
File "/path/to/pyenv/versions/3.9.16/lib/python3.9/threading.py", line 980, in _bootstrap_inner
self.run()
File "/path/to/pyenv/versions/3.9.16/lib/python3.9/threading.py", line 917, in run
self._target(*self._args, **self._kwargs)
File "/path/to/pyenv/versions/mm3.9.16/lib/python3.9/site-packages/google/cloud/pubsub_v1/publisher/_batch/thread.py", line 274, in _commit
response = self._client._gapic_publish(
File "/path/to/pyenv/versions/mm3.9.16/lib/python3.9/site-packages/google/cloud/pubsub_v1/publisher/client.py", line 267, in _gapic_publish
return super().publish(*args, **kwargs)
File "/path/to/pyenv/versions/mm3.9.16/lib/python3.9/site-packages/google/pubsub_v1/services/publisher/client.py", line 1061, in publish
response = rpc(
File "/path/to/pyenv/versions/mm3.9.16/lib/python3.9/site-packages/google/api_core/gapic_v1/method.py", line 116, in __call__
wrapped_func = _apply_decorators(self._target, [retry, timeout])
File "/path/to/pyenv/versions/mm3.9.16/lib/python3.9/site-packages/google/api_core/gapic_v1/method.py", line 58, in _apply_decorators
func = decorator(func)
TypeError: 'str' object is not callable
The text was updated successfully, but these errors were encountered:
Environment details
google-cloud-pubsub
version: 2.21.1Steps to reproduce
google.cloud.pubsub_v1.PublisherClient
instance and call thepublish
method withtimeout="some_string"
orretry="some_string"
(causes error in batch thread) and then call theresult()
method on the returned future.Code example
Start a pubsub emulator locally, create the below topic and set the PUBSUB_EMULATOR_HOST variable to point to it. Then:
The script prints the below strack trace and hangs (indefinitely?), blocking in
future.result()
.While adding some sanity checks on the arguments to publish() would fix this particular instance of the problem, the fundamental problem here appears to be that there's no catch-all try-except in the batch thread ensuring that it will always terminate gracefully.
Stack trace
The uncaught error in the batch thread is caught and printed to stderr by code in the threading module:
The text was updated successfully, but these errors were encountered: