From 68f985d2c6f3ca5653448daf5456a7a2a2f7b93f Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 27 Mar 2019 02:25:06 +0100 Subject: [PATCH] Copy websockets list before iterating over it to prevent race conditions upon list changed upon iteration --- platypush/backend/http/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platypush/backend/http/__init__.py b/platypush/backend/http/__init__.py index b7796ffd8..a01944181 100644 --- a/platypush/backend/http/__init__.py +++ b/platypush/backend/http/__init__.py @@ -204,7 +204,8 @@ class HttpBackend(Backend): loop = get_or_create_event_loop() - for websocket in self.active_websockets: + websockets = self.active_websockets.copy() + for websocket in websockets: try: loop.run_until_complete(send_event(websocket)) except websockets.exceptions.ConnectionClosed: