'NoneType' object has no attribute 'can_read' at redis.py:670
See original GitHub issueI run celery on docker, redis on another server. Celery==4.0.0 redis==2.10.5 redis server is v 2.8.4
My celery configuration is very simple, only broker and backend, both are redis. The task I’m running is gunzipping a 10GB file. It takes 10 minutes to finish.
Traceback (most recent call last):
File "/venv/lib/python3.4/site-packages/celery/worker/worker.py", line 203, in start
self.blueprint.start(self)
File "/venv/lib/python3.4/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/venv/lib/python3.4/site-packages/celery/bootsteps.py", line 370, in start
return self.obj.start()
File "/venv/lib/python3.4/site-packages/celery/worker/consumer/consumer.py", line 318, in start
blueprint.start(self)
File "/venv/lib/python3.4/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/venv/lib/python3.4/site-packages/celery/worker/consumer/consumer.py", line 584, in start
c.loop(*c.loop_args())
File "/venv/lib/python3.4/site-packages/celery/worker/loops.py", line 88, in asynloop
next(loop)
File "/venv/lib/python3.4/site-packages/kombu/async/hub.py", line 345, in create_loop
cb(*cbargs)
File "/venv/lib/python3.4/site-packages/kombu/transport/redis.py", line 1038, in on_readable
self.cycle.on_readable(fileno)
File "/venv/lib/python3.4/site-packages/kombu/transport/redis.py", line 337, in on_readable
chan.handlers[type]()
File "/venv/lib/python3.4/site-packages/kombu/transport/redis.py", line 670, in _receive
while c.connection.can_read(timeout=0):
AttributeError: 'NoneType' object has no attribute 'can_read'
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
django - Celery unable to use redis - Stack Overflow
... in <module> class PrefixedStrictRedis(GlobalKeyPrefixMixin, redis.Redis): AttributeError: 'NoneType' object has no attribute 'Redis'.
Read more >Grokzen/redis-py-cluster - Gitter
_buffer.readline() AttributeError: 'NoneType' object has no attribute 'readline'. you should be able to repro using this script: ...
Read more >AttributeError: 'NoneType' object has no attribute 'get_items'
Hello everyone, We have imported one job (Local Resolution Estimation) from an old project and an old instance onto a newly installed, ...
Read more >AttributeError: 'NoneType' object has no attribute 'parents'
Thread.run(self) AttributeError: 'NoneType' object has no attribute 'parents' Additional info: addons: com_redhat_kdump cmdline: ...
Read more >'NoneType' object has no attribute 'connection_pool' - #sentry
No broken requirements found. (sentry2) blankhost sentry2 # redis-cli 127.0.0.1:6379> ping. PONG 127.0.0.1:6379> exit ( ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The change applied in https://github.com/celery/kombu/commit/66325920c72d395a7f1bafdf97d5462b7ce5b3f8 does not really fix the issue. The problem is the
connection
property is reset toNone
the moment a socket is terminated, and the few microseconds between the checkif c.connection is not None
and the next linewhile c.connection.can_read(timeout=0)
is enough time for this to happen. You will only encounter this on a slow network or a network with packet loss. The two lines need to be threadsafe, and the only quick solution I see is to rewrite it as:This is ugly because AttributeError is such a broad exception. It would be nice to have eg. ConnectionLostError raised in the underlying code.
@thedrow Why do you want me to open a new (empty) issue when you have all the details AND the solution (or at least a workaround) to the problem here? Can’t you just re-open this one?