Wed, Apr 01, 2020 at 06:52:51PM CEST, olichtne(a)redhat.com wrote:
From: Ondrej Lichtner <olichtne(a)redhat.com>
Before calling select on provided connection/socket objects we need to
check if any of them may have been closed and need to be removed first.
Not quite sure but don't we need to first check if there was any data
available on the connection/socket? With the patch we could silently
discard such data.
The main reason for this is that a closed multiprocessing.Connection
object may be present in the list which will result in the following
select call returning with an exception. This exception doesn't indicate
which of the file objects causes the issue and selecting for "error"
file descriptors also doesn't help. As such we need to check this before
calling select.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Common/ConnectionHandler.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lnst/Common/ConnectionHandler.py b/lnst/Common/ConnectionHandler.py
index 3f7f99f..a74d4a8 100644
--- a/lnst/Common/ConnectionHandler.py
+++ b/lnst/Common/ConnectionHandler.py
@@ -59,6 +59,11 @@ class ConnectionHandler(object):
return self._check_connections(connections, timeout)
def _check_connections(self, connections, timeout):
+ for c in list(connections):
+ if c.closed:
+ self.remove_connection(c)
+ connections.remove(c)
+
requests = []
try:
rl, wl, xl = select.select(connections, [], [], timeout)
--
2.26.0
_______________________________________________
LNST-developers mailing list -- lnst-developers(a)lists.fedorahosted.org
To unsubscribe send an email to lnst-developers-leave(a)lists.fedorahosted.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedora...