From 566db546faafb9c2c2570aa11d6d84de715cd05f Mon Sep 17 00:00:00 2001 From: Daniel Kohler <11864045+ddkohler@users.noreply.github.com> Date: Mon, 24 Nov 2025 14:52:04 -0600 Subject: [PATCH 1/5] Update _protocol.py --- yaqd-core/yaqd_core/_protocol.py | 1 + 1 file changed, 1 insertion(+) diff --git a/yaqd-core/yaqd_core/_protocol.py b/yaqd-core/yaqd_core/_protocol.py index 6644a08..b2e8d2e 100644 --- a/yaqd-core/yaqd_core/_protocol.py +++ b/yaqd-core/yaqd_core/_protocol.py @@ -93,6 +93,7 @@ async def process_requests(self): f"Wrote response {response}, {response_out.getvalue()}" ) self.transport.write(struct.pack(">L", 0)) + self.unpacker._file = io.BytesIO() if name == "shutdown": self.logger.debug("Closing transport") self.transport.close() From 51696543a1c3f553e5d7c1bec3d86644cdd47772 Mon Sep 17 00:00:00 2001 From: Daniel Kohler <11864045+ddkohler@users.noreply.github.com> Date: Mon, 24 Nov 2025 15:26:55 -0600 Subject: [PATCH 2/5] Update CHANGELOG.md --- yaqd-core/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/yaqd-core/CHANGELOG.md b/yaqd-core/CHANGELOG.md index 5f8d640..cabc8f6 100644 --- a/yaqd-core/CHANGELOG.md +++ b/yaqd-core/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/). ## [Unreleased] ### Fixed +- daemon servers no longer keep all recieved messages in memory - type hints for IsSensor attributes are appropriate for _n_-dimensional data ## [2023.11.0] From e2a735f616337ef695bfca53a0fba5926dea75ac Mon Sep 17 00:00:00 2001 From: Daniel Kohler <11864045+ddkohler@users.noreply.github.com> Date: Tue, 9 Dec 2025 14:55:36 -0600 Subject: [PATCH 3/5] unpacker clears _file itself --- yaqd-core/yaqd_core/_protocol.py | 3 ++- yaqd-core/yaqd_core/avrorpc/unpacker.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/yaqd-core/yaqd_core/_protocol.py b/yaqd-core/yaqd_core/_protocol.py index b2e8d2e..8051199 100644 --- a/yaqd-core/yaqd_core/_protocol.py +++ b/yaqd-core/yaqd_core/_protocol.py @@ -35,10 +35,12 @@ def data_received(self, data): self.logger.debug(f"Data received: {repr(data)}") if not self._daemon._server.is_serving(): self.transport.close() + self.logger.info("feeding") self.unpacker.feed(data) async def process_requests(self): async for hs, meta, name, params in self.unpacker: + self.logger.info("unpacking") if hs is not None: out = bytes(hs) out = struct.pack(">L", len(out)) + out @@ -93,7 +95,6 @@ async def process_requests(self): f"Wrote response {response}, {response_out.getvalue()}" ) self.transport.write(struct.pack(">L", 0)) - self.unpacker._file = io.BytesIO() if name == "shutdown": self.logger.debug("Closing transport") self.transport.close() diff --git a/yaqd-core/yaqd_core/avrorpc/unpacker.py b/yaqd-core/yaqd_core/avrorpc/unpacker.py index 1d507f7..a8ccc01 100644 --- a/yaqd-core/yaqd_core/avrorpc/unpacker.py +++ b/yaqd-core/yaqd_core/avrorpc/unpacker.py @@ -71,6 +71,10 @@ def feed(self, data: bytes): # Must support random access, if it does not, must be fed externally (e.g. TCP) pos = self._file.tell() self._file.seek(0, 2) + if pos == self._file.tell(): + # read reached EOF and we are safe to clear + self._file = io.BytesIO() + pos = 0 self._file.write(data) self._file.seek(pos) self.new_data.set() From f475fb314b3122b042d3978459d9d854d23276a2 Mon Sep 17 00:00:00 2001 From: Daniel Kohler <11864045+ddkohler@users.noreply.github.com> Date: Tue, 9 Dec 2025 15:07:30 -0600 Subject: [PATCH 4/5] cleanup --- yaqd-core/yaqd_core/_protocol.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/yaqd-core/yaqd_core/_protocol.py b/yaqd-core/yaqd_core/_protocol.py index 8051199..6644a08 100644 --- a/yaqd-core/yaqd_core/_protocol.py +++ b/yaqd-core/yaqd_core/_protocol.py @@ -35,12 +35,10 @@ def data_received(self, data): self.logger.debug(f"Data received: {repr(data)}") if not self._daemon._server.is_serving(): self.transport.close() - self.logger.info("feeding") self.unpacker.feed(data) async def process_requests(self): async for hs, meta, name, params in self.unpacker: - self.logger.info("unpacking") if hs is not None: out = bytes(hs) out = struct.pack(">L", len(out)) + out From 447dfcdad51d58714c7e1315d7cfefef1671aa60 Mon Sep 17 00:00:00 2001 From: Daniel Kohler <11864045+ddkohler@users.noreply.github.com> Date: Tue, 16 Dec 2025 22:19:37 -0600 Subject: [PATCH 5/5] Update unpacker.py --- yaqd-core/yaqd_core/avrorpc/unpacker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yaqd-core/yaqd_core/avrorpc/unpacker.py b/yaqd-core/yaqd_core/avrorpc/unpacker.py index a8ccc01..35e4413 100644 --- a/yaqd-core/yaqd_core/avrorpc/unpacker.py +++ b/yaqd-core/yaqd_core/avrorpc/unpacker.py @@ -73,7 +73,8 @@ def feed(self, data: bytes): self._file.seek(0, 2) if pos == self._file.tell(): # read reached EOF and we are safe to clear - self._file = io.BytesIO() + self._file.seek(0) + self._file.truncate(0) pos = 0 self._file.write(data) self._file.seek(pos)