Open matt-mcallister opened 6 months ago
I suppose that I am suffering from the same problem. https://stackoverflow.com/questions/78337450/publishing-message-to-gcp-pubsub-from-a-fastapi-app is there any workaround?
As I am using the PublisherClient from CloudRun, I can´t find way to reuse the same PublisherClient. It seems a so basic use case.
Hello,
I have exactly the same problem. I use the PublisherClient
in an Apache Beam (Dataflow) job and I noticed mutual blocking problems.
I have a fairly simple way to reproduce it:
import threading
from google.cloud import pubsub_v1
def pubsub():
for i in [1, 2, 3, 4, 5]:
print(i)
pubsub_v1.PublisherClient()
t1 = threading.Thread(target=pubsub)
t2 = threading.Thread(target=pubsub)
t1.start()
t2.start()
t1.join()
t2.join()
Producing:
$ python block.py
1
1
^C^C^C^C
[1] 63732 terminated python3 block.py
OS: macOS 14.4.1 (23E224) - M2 Pro
Python: Python 3.12.1
google-cloud-pubsub: 2.21.1
I hope this will help you. If there is a need to open another issue, no problem.
Thank you in advance for your help.
Environment details
python:3.10.13-bookworm
as the base image3.10.13
23.0.1
google-cloud-pubsub
version:2.19.7
Steps to reproduce
Calling
PublisherClient.from_service_account_info()
from multiple concurrent threads causes the program to hang.Code example
Output
Stack trace
The program hangs so there is no stack trace, but this is the core dump