Each time a public request is made, the memory in the pod of Kubernetes increases. Removing the publishing part does not increase memory.
The pod is continuously restarted due to OOM.
Environment details
- OS type and version: Debian GNU/Linux 10
- Python version: 3.8.7
- pip version: 21.0.1
google-cloud-pubsub version: 2.4.1
Code example
class PublishToPubsubCallback(Callback):
def __init__(self, pod_name, project_id, topic_id, preprocess=[]):
super(PublishToPubsubCallback, self).__init__(pod_name, preprocess=preprocess)
self.project_id = project_id
self.topic_id = topic_id
self.publisher = pubsub_v1.PublisherClient()
self.topic_path = self.publisher.topic_path(project_id, topic_id)
def __call__(self, data):
pub_data = json.dumps(data).encode('utf-8')
self.publisher.publish(self.topic_path, pub_data)
callback = PublishToPubsubCallback(pod_name, project_id, topic_id)
async def run():
while True:
data = await watch_websocket_data()
callback(data)
loop = asyncio.get_event_loop()
loop.run_until_complete(run())

Each time a public request is made, the memory in the pod of Kubernetes increases. Removing the publishing part does not increase memory.
The pod is continuously restarted due to OOM.
Environment details
google-cloud-pubsubversion: 2.4.1Code example