Skip to content

Commit 46f3245

Browse files
authored
Freezing zombie channels into a list avoids RuntimeError
Fixes Supervisor#1178 which says that a ___RuntimeError__ is raised when the dictionary size changes during iteration. This change freezes dict.values() into a list before the loop begins so that the list will not change during iteration.
1 parent 5b5624a commit 46f3245

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

supervisor/medusa/http_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ def maintenance (self):
506506

507507
def kill_zombies (self):
508508
now = int (time.time())
509-
for channel in asyncore.socket_map.values():
509+
for channel in list(asyncore.socket_map.values()):
510510
if channel.__class__ == self.__class__:
511511
if (now - channel.last_used) > channel.zombie_timeout:
512512
channel.close()

0 commit comments

Comments
 (0)