Race condition in connection disconnect
See original GitHub issueIt seems like there is a race condition in the code for Connection.disconnect(). I run redis as a celery broker, so I seem to be running into a situation where I get a TypeError: NoneType has no attribute _close(). It would appear that in one process disconnect() is being called and setting the self._sock to None while another process has already executed the if statement that checks if self._sock is None.
def disconnect(self):
"Disconnects from the Redis server"
self._parser.on_disconnect()
if self._sock is None:
return
try:
self._sock.shutdown(socket.SHUT_RDWR)
self._sock.close()
except socket.error:
pass
self._sock = None
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:32 (15 by maintainers)
Top Results From Across the Web
What is a Race Condition?
A race condition is an undesirable situation that occurs when a device or system attempts to perform two or more operations at the...
Read more >Race condition in connection disconnect · Issue #732
The idea is use the shutdown syscall and call it from the pool connection and out of the current disconnect mehod that belongs...
Read more >PH21216: A RACE CONDITION TO CLOSE A TCP/IP ...
A race condition exists between IBM MQ clients and queue manager when closing down a TCP/IP network connection. The network resource at the...
Read more >multithreading - What is a race condition?
A race condition occurs when two or more threads can access shared data and they try to change it at the same time....
Read more >How to Prevent Race Conditions in Web Applications
Another way of putting it is: when the timing of actions impact other actions, events may happen out of sequence, resulting in anomalous ......
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 Free
Top 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

Ill be out two days. I will check it then. In any case thanks for your detailed comment.
3.2.0 has just been released and fixes this issues.