diff --git a/lib/ansible/runner/connection_plugins/fireball2.py b/lib/ansible/runner/connection_plugins/fireball2.py index b9a4748039..30c56442a2 100644 --- a/lib/ansible/runner/connection_plugins/fireball2.py +++ b/lib/ansible/runner/connection_plugins/fireball2.py @@ -85,11 +85,17 @@ class Connection(object): header_len = 8 # size of a packed unsigned long long data = b"" while len(data) < header_len: - data += self.conn.recv(1024) + d = self.conn.recv(1024) + if not d: + return None + data += d data_len = struct.unpack('Q',data[:header_len])[0] data = data[header_len:] while len(data) < data_len: - data += self.conn.recv(1024) + d = self.conn.recv(1024) + if not d: + return None + data += d return data def exec_command(self, cmd, tmp_path, sudo_user, sudoable=False, executable='/bin/sh'): diff --git a/library/utilities/fireball2 b/library/utilities/fireball2 index e92d0817d8..9d32e1ddd2 100644 --- a/library/utilities/fireball2 +++ b/library/utilities/fireball2 @@ -163,7 +163,10 @@ class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler): data_len = struct.unpack('Q',data[:header_len])[0] data = data[header_len:] while len(data) < data_len: - data += self.request.recv(1024) + d = self.request.recv(1024) + if not d: + return None + data += d return data def handle(self):