From a15434783421885edc4a1e37915faf6a34a3ec29 Mon Sep 17 00:00:00 2001 From: link2xt Date: Tue, 3 Oct 2023 21:35:29 +0000 Subject: [PATCH] fix(deltachat-rpc-client): increase stdio buffer to 64 MiB Otherwise readline() gets stuck when JSON-RPC response is longer that 64 KiB. --- deltachat-rpc-client/src/deltachat_rpc_client/rpc.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/deltachat-rpc-client/src/deltachat_rpc_client/rpc.py b/deltachat-rpc-client/src/deltachat_rpc_client/rpc.py index c43c363c1..a3df4723e 100644 --- a/deltachat-rpc-client/src/deltachat_rpc_client/rpc.py +++ b/deltachat-rpc-client/src/deltachat_rpc_client/rpc.py @@ -29,10 +29,16 @@ class Rpc: self.events_task: asyncio.Task async def start(self) -> None: + # Use buffer of 64 MiB. + # Default limit as of Python 3.11 is 2**16 bytes, this is too low for some JSON-RPC responses, + # such as loading large HTML message content. + limit = 2**26 + self.process = await asyncio.create_subprocess_exec( "deltachat-rpc-server", stdin=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE, + limit=limit, **self._kwargs, ) self.id = 0