Tradfri. Aiocoap. What is this error about tinydtls.py?

as title:

2018-07-17 14:50:02 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
    Traceback (most recent call last):
      File "/usr/lib/python3.6/site-packages/aiocoap/transports/tinydtls.py", line 160, in _run
        message = yield from self._queue.get()
      File "/usr/lib/python3.6/site-packages/aiocoap/util/asyncio.py", line 40, in get
        priority, first = yield from self._inner.get()
      File "/usr/lib/python3.6/asyncio/queues.py", line 167, in get
        yield from getter
    concurrent.futures._base.CancelledError

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/lib/python3.6/site-packages/aiocoap/transports/tinydtls.py", line 169, in _run
        self.coaptransport.new_error_callback(-1, self)
      File "/usr/lib/python3.6/site-packages/aiocoap/protocol.py", line 203, in _dispatch_error
        for key, (monitor, cancellable_timeout) in self._active_exchanges.items():
    AttributeError: 'NoneType' object has no attribute 'items'

Traceback (most recent call last):
File “uvloop/sslproto.pyx”, line 245, in uvloop.loop._SSLPipe.feed_appdata
File “/usr/lib/python3.6/site-packages/aiocoap/protocol.py”, line 732, in timeout_request
del self.protocol.outgoing_requests[(request.token, request.remote)]
KeyError: (b’\x00\x00\x9dc’, <aiocoap.transports.tinydtls.DTLSClientConnection object at 0x721b4bd0>)

spontaneous reboots…

answering to myself here, hope anyone else reads it:

seems a Tradfri issue, could anyone conform this shouldn’t be a problem any longer in HomeAssistant? And if so, why did this start as of today…Hope @balloob could have some specifics on this, since you’re participating in the quoted discussion?

still an issue… + 2 years:

2020-07-04 11:56:02 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiocoap/transports/tinydtls.py", line 157, in _run
    yield from self._connecting
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiocoap/transports/tinydtls.py", line 169, in _run
    self.coaptransport.new_error_callback(-1, self)
  File "/usr/local/lib/python3.7/site-packages/aiocoap/protocol.py", line 203, in _dispatch_error
    for key, (monitor, cancellable_timeout) in self._active_exchanges.items():
AttributeError: 'NoneType' object has no attribute 'items'

how to get finally rid of this.

I have a similar issue (2022.5.0b4):


[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
/usr/local/lib/python3.9/site-packages/aiocoap/transports/tinydtls.py:162: UserWarning: DTLS module did not shut down the DTLSSocket perfectly; it still tried to call _write in vain
  warnings.warn("DTLS module did not shut down the DTLSSocket "
Exception ignored in: <function DTLSClientConnection.__del__ at 0x7f49cffc3280>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiocoap/transports/tinydtls.py", line 252, in __del__
  File "/usr/local/lib/python3.9/site-packages/aiocoap/transports/tinydtls.py", line 235, in shutdown
AttributeError: 'DTLSClientConnection' object has no attribute '_retransmission_task'
Exception ignored in: <function DTLSClientConnection.__del__ at 0x7f49cffc3280>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiocoap/transports/tinydtls.py", line 252, in __del__
  File "/usr/local/lib/python3.9/site-packages/aiocoap/transports/tinydtls.py", line 235, in shutdown
AttributeError: 'DTLSClientConnection' object has no attribute '_retransmission_task'
[finish] process exit code 0
s6-svscanctl: fatal: unable to control /var/run/s6/services: supervisor not listening
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.

Hi! I am seeing the same in my log, did some of you solved this?

Edit: I just found this:

It´s just happening during reboot

no its not happening only under reboot, and its not solved either…

I’ve opened this in the aiocoap repo Tradfri: Home Assistant: TypeError("'NoneType' object does not support item assignment") · Issue #333 · chrysn/aiocoap · GitHub