qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] python: honour message limit when using pre-opened socket
@ 2023-03-20 10:54 Daniel P. Berrangé
  2023-03-20 10:55 ` Marc-André Lureau
  2023-03-20 12:20 ` Vladimir Sementsov-Ogievskiy
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel P. Berrangé @ 2023-03-20 10:54 UTC (permalink / raw)
  To: qemu-devel
  Cc: Vladimir Sementsov-Ogievskiy, Cleber Rosa, Beraldo Leal,
	John Snow, Marc-André Lureau, Daniel P. Berrangé

The default message recv limit in asyncio is smaller than our needs, so
when opening connections we override it. This was done when opening a
connection using a socket address, but was missed when using a
pre-opened socket file descriptor.

This latent bug was exposed when the QEMUMachine class was enhanced to
use socketpair() when no socket address was passed by:

  commit bd4c0ef409140bd1be393407c04005ac077d4574
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   Wed Jan 11 12:01:01 2023 +0400

    python/qemu/machine: use socketpair() for QMP by default

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 python/qemu/qmp/protocol.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/python/qemu/qmp/protocol.py b/python/qemu/qmp/protocol.py
index 22e60298d2..2bd341a93e 100644
--- a/python/qemu/qmp/protocol.py
+++ b/python/qemu/qmp/protocol.py
@@ -307,7 +307,10 @@ async def open_with_socket(self, sock: socket.socket) -> None:
 
         :raise StateError: When the `Runstate` is not `IDLE`.
         """
-        self._reader, self._writer = await asyncio.open_connection(sock=sock)
+        self._reader, self._writer = await asyncio.open_connection(
+            sock=sock,
+            limit=self._limit,
+        )
         self._set_state(Runstate.CONNECTING)
 
     @upper_half
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-05-17 18:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-20 10:54 [PATCH] python: honour message limit when using pre-opened socket Daniel P. Berrangé
2023-03-20 10:55 ` Marc-André Lureau
2023-03-20 12:20 ` Vladimir Sementsov-Ogievskiy
2023-03-21  0:27   ` John Snow
2023-05-15 21:14     ` John Snow
2023-05-17 18:07       ` John Snow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).