Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
As far as I know, the only errors that you're supposed to "except: pass" from socket.shutdown are OSErrors. I think you want anything else (if it even throws anything else?) to be fatal.
This is the same way cpython handles it: https://github.com/python/cpython/blob/b56774bd93822e1598bb5...
If either shutdown (or close) raises an exception, self.sock isn't set to None. Thus Python retains the reference.
https://github.com/celery/celery/issues/4843#issuecomment-99...
Another way you can have leaks with a reference counting GC is through circular references. Python provides WeakRef for such situations, but it's up to the programmer to use it correctly.
I tested your theory on this branch of py-amqp: https://github.com/pawl/py-amqp/commit/45f5eef6f650daaaf662d...
It still leaks if you don't close the socket.
Related posts
- Dramatiq: A fast and reliable distributed task processing library for Python
- Streaming responses to websockets with multiple LLMs, am I going about this wrong?
- Arq vs Dramatiq vs Taskiq vs Repid
- FastAPI + Celery problem: Celery task is still getting exectued even though I'm raising an exception on task_prerun
- django celery priority