pycapnp/capnp
Lasse Blaauwbroek ca8d120901 Handle exceptions from server callbacks
In its current form, when a server callback throws an exception, it is
completely swallowed. Only when the asyncio loop is being shut down might one
possibly see that error. On top of that, the connection is never closed, causing
any clients to hang, and a memory leak in the server.

This is a proposed fix that reports the exception to the asyncio exception
handler. It also makes sure that the connection is always closed, even if the
callback doesn't close it explicitly.

Note that the design of AsyncIoStream is directly based on the design of
Python's asyncio streams: https://docs.python.org/3/library/asyncio-stream.html
These streams appear to have exactly the same flaw. I've reported this here:
https://github.com/python/cpython/issues/110894. Since I don't really know what
I'm doing, it might be worth seeing what kind of solution they might come up
with and model our solution after theirs.
2023-10-22 23:29:47 -07:00
..
helpers Experiment: Wrap all capnp code in a context-manager to avoid segfaults (#317) 2023-10-03 09:04:51 -07:00
includes Prepare for v2.0.0b1 release 2023-10-03 12:29:48 -07:00
lib Handle exceptions from server callbacks 2023-10-22 23:29:47 -07:00
templates bool → cbool (probably just a typo) 2021-04-25 21:51:12 +02:00
__init__.pxd Refactor layout of pxd files 2013-12-08 17:27:59 -08:00
__init__.py Get rid of VoidPromise and (almost) Promise 2023-06-08 08:02:07 +02:00
_gen.py Applying black formatting 2021-10-01 11:12:21 -07:00