[lxc-devel] [pylxd/master] Fix race condition in 2.2.8 generating long pauses

lasizoillo on Github lxc-bot at linuxcontainers.org
Thu Nov 22 04:42:56 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 816 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20181122/6b38e63b/attachment.bin>
-------------- next part --------------
From 2a566eb2403d3afdec5275f24e5fb163b7e7f392 Mon Sep 17 00:00:00 2001
From: lasizoillo <lasizoillo at gmail.com>
Date: Thu, 22 Nov 2018 04:31:56 +0100
Subject: [PATCH] Fix race condition in 2.2.8 generating long pauses

Signed-off-by: lasizoillo <lasizoillo at gmail.com>
---
 pylxd/models/container.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pylxd/models/container.py b/pylxd/models/container.py
index a985691..a6db5ab 100644
--- a/pylxd/models/container.py
+++ b/pylxd/models/container.py
@@ -21,6 +21,7 @@
 try:
     from ws4py.client import WebSocketBaseClient
     from ws4py.manager import WebSocketManager
+    from ws4py.messaging import BinaryMessage
     _ws4py_installed = True
 except ImportError:  # pragma: no cover
     WebSocketBaseClient = object
@@ -520,6 +521,8 @@ def received_message(self, message):
         if self.handler:
             self.handler(self._maybe_decode(message.data))
         self.buffer.append(message.data)
+        if isinstance(message, BinaryMessage):
+            self.manager.remove(self)
 
     def _maybe_decode(self, buffer):
         if self.decode and buffer is not None:


More information about the lxc-devel mailing list