Open acolavin opened 1 year ago
I ran the code provided. I was not able to reproduce the issue with the latest version of the client library:
python3 repro_batch.py
Message size is 1.000033MB
Batch size is 1000000
The future result is: 12919415560370439
I tried both from google.cloud import pubsub
that you use in your code and and from google.cloud import pubsub_v1
, that is the recommended import for publishes. Could you please let me know if you're still facing the issue / consistently able to reproduce it?
Howdy folks,
We ran across undesirable behavior stemming from this python pubsub library. We found several unintuitive workarounds (described below), and we're sharing the behavior here for the developers' benefit, and for others who run into this behavior.
Briefly, we found that a submitting many jobs of intermediate message size to a nascent PublisherClient instance causes publishing to hang. Smaller or larger messages don't seem to cause hanging. The problematic message size threshold can be altered by changing the Publisher batch settings. Submitting a single job to the PublisherClient to completion also suppresses this behavior, as does checking credentials before submitting the bolus of jobs.
We do see a stack trace that suggests an authentication issue reminiscent of similar issues reported in other related libraries, such as this one, but we believe the issue stems from how pubsub handles credentials and job batching.
All this and more is enumerated in the code for reproducing the behavior.
Also of note: we could only reproduce this behavior on ubuntu. I could not figure out how to reproduce this on a mac.
Environment details
Steps to reproduce
Code example
Stack trace
Subsequent attempts to submit jobs in the same python thread will eventually yield the following traceback: