The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/pylxd/pull/337

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: lasizoillo <lasizoi...@gmail.com>

LXD sends TextMessage frames until the last one, then send a BinaryMessage and closes connection. If connection is closed no read events can't arrive to EPollPoller and ws4py doesn't read more data. But ws4py get into a loop in some cases waiting for streaming data to complete a message frame. There are another infinite loop waiting to ws4py to drain connection buffer.

I hope this fix resolve all corner cases. If not, I hope be more free to fix it sooner.
From 2a566eb2403d3afdec5275f24e5fb163b7e7f392 Mon Sep 17 00:00:00 2001
From: lasizoillo <lasizoi...@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 <lasizoi...@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:
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to