OpenCyphal / pycyphal

Python implementation of the Cyphal protocol stack.
https://pycyphal.readthedocs.io/
MIT License
117 stars 106 forks source link

DiagnosticPublisher mishandles publication future on close() #192

Closed pavel-kirienko closed 2 years ago

pavel-kirienko commented 2 years ago
Traceback (most recent call last):
  File "/home/pavel/uavcan/pyuavcan/pyuavcan/util/_broadcast.py", line 46, in delegate
    r: typing.Union[R, Exception] = fn(*args, **kwargs)
  File "/home/pavel/uavcan/pyuavcan/pyuavcan/application/diagnostic.py", line 145, in close
    self._fut.result()
asyncio.exceptions.InvalidStateError: Result is not set.

Should either check if the future is done or catch InvalidStateError:

https://github.com/UAVCAN/pyuavcan/blob/9da3cf579b65cae4067b16c621cc3321156f17d4/pyuavcan/application/diagnostic.py#L145