You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a Home Assistant component that needs to communicate with several devices at the same time. Additionally, the devices can push notifications which seems to require a server context with a Site attached to receive them. Unfortunately, another user who has the ws transport enabled is getting the following upon the creation of the second server context:
Traceback (most recent call last):
File "/config/deps/lib/python3.9/site-packages/aiohomekit/controller/coap/connection.py", line 602, in connect
await self.do_pair_verify(pairing_data)
File "/config/deps/lib/python3.9/site-packages/aiohomekit/controller/coap/connection.py", line 557, in do_pair_verify
coapClient = await Context.create_server_context(root, bind=('::',0))
File "/usr/local/lib/python3.9/site-packages/aiocoap/protocol.py", line 293, in create_server_context
await self._append_tokenmanaged_transport(
File "/usr/local/lib/python3.9/site-packages/aiocoap/protocol.py", line 157, in _append_tokenmanaged_transport
transport = await token_interface_constructor(tman)
File "/usr/local/lib/python3.9/site-packages/aiocoap/transports/ws.py", line 191, in create_transport
server = await websockets.serve(
File "/usr/local/lib/python3.9/site-packages/websockets/legacy/server.py", line 1086, in __await_impl__
server = await self._create_server()
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1494, in create_server
raise OSError(err.errno, 'error while attempting '
OSError: [Errno 98] error while attempting to bind on address ('::', 3000, 0, 0): address in use
I don't think using an environment variable is a good solution here as that is process-wide and I don't know what other HA plugins might require. Do you think a transport= parameter to create_server_context would be an appropriate solution? Or would you prefer a fix to the ws transport? Both? Looking forward to your thoughts here. Thanks!
Python version: 3.9.9 (main, Nov 19 2021, 00:00:00)
[GCC 11.2.1 20210728 (Red Hat 11.2.1-1)]
aiocoap version: 0.4.1
Modules missing for subsystems:
dtls: missing DTLSSocket
oscore: missing cbor2, ge25519
linkheader: missing LinkHeader
prettyprint: missing LinkHeader, cbor2, termcolor, pygments
Python platform: linux
Default server transports: tcpserver:tcpclient:tlsserver:tlsclient:udp6
Selected server transports: tcpserver:tcpclient:tlsserver:tlsclient:udp6
Default client transports: tcpclient:tlsclient:udp6
Selected client transports: tcpclient:tlsclient:udp6
SO_REUSEPORT available (default, selected): True, True
The text was updated successfully, but these errors were encountered:
roysjosh
added a commit
to roysjosh/aiocoap
that referenced
this issue
Jan 21, 2022
I'm working on a Home Assistant component that needs to communicate with several devices at the same time. Additionally, the devices can push notifications which seems to require a server context with a Site attached to receive them. Unfortunately, another user who has the
ws
transport enabled is getting the following upon the creation of the second server context:This is in spite of me passing a
bind=('::',0)
parameter to thecreate_server_context
call asking for a random port: https://github.com/Jc2k/aiohomekit/pull/52/files#diff-4d3bce65cb96997bae448f68447d41b128f33e8fbdffb019c73caa183ce28833R480It looks like the
ws
transport doesn't know that 0 means random as it adds a fixed value of 3000 to ports that aren'tNone
: https://github.com/chrysn/aiocoap/blob/master/aiocoap/transports/ws.py#L190I don't think using an environment variable is a good solution here as that is process-wide and I don't know what other HA plugins might require. Do you think a
transport=
parameter tocreate_server_context
would be an appropriate solution? Or would you prefer a fix to thews
transport? Both? Looking forward to your thoughts here. Thanks!The text was updated successfully, but these errors were encountered: