I instantiate like this with ZeroConf.
def register_mdns(r_name):
addresses = []
for ifen in ni.interfaces():
ifenaddr = ni.ifaddresses(ifen)
if ni.AF_INET in ifenaddr:
addresses.append(socket.inet_pton(
ni.AF_INET,
ifenaddr[ni.AF_INET][0]["addr"])
)
if ni.AF_INET6 in ifenaddr:
addresses.append(socket.inet_pton(
ni.AF_INET6,
ifenaddr[ni.AF_INET6][0]["addr"].split("%")[0])
)
info = ServiceInfo(
"_service._tcp.local.",
"%s._service._tcp.local." % r_name,
addresses=addresses,
port=1234,
properties=mdns_props,
server="%s.local." % receiver_name,
)
zeroconf = Zeroconf(ip_version=IPVersion.V4Only)
zeroconf.register_service(info)
print("mDNS service registered")
return (zeroconf, info)
def unregister_mdns(zeroconf, info):
print("Unregistering...")
zeroconf.unregister_service(info)
zeroconf.close()
Works OK in 0.31.0. Problem starts from 0.32.0
But at shutdown, this happens. Is it normal now in 0.33?
^CShutting down mDNS...
Unregistering...
Exception in callback _SelectorDatagramTransport._read_ready()
handle: <Handle _SelectorDatagramTransport._read_ready()>
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/events.py", line 80, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 1029, in _read_ready
self._protocol.datagram_received(data, addr)
File "/usr/local/lib/python3.9/site-packages/zeroconf/_core.py", line 272, in datagram_received
self.zc.handle_response(msg)
File "/usr/local/lib/python3.9/site-packages/zeroconf/_core.py", line 693, in handle_response
self.record_manager.async_updates_from_response(msg)
File "/usr/local/lib/python3.9/site-packages/zeroconf/_handlers.py", line 387, in async_updates_from_response
self.cache.async_remove_records(removes)
File "/usr/local/lib/python3.9/site-packages/zeroconf/_cache.py", line 102, in async_remove_records
self._async_remove(entry)
File "/usr/local/lib/python3.9/site-packages/zeroconf/_cache.py", line 94, in _async_remove
_remove_key(self.cache, entry.key, entry)
File "/usr/local/lib/python3.9/site-packages/zeroconf/_cache.py", line 49, in _remove_key
del cache[key][entry]
KeyError: record[quada,in-unique,xxxx.local.]=0/0,fe80::819:95ff:fe23:9e09
Tried with different ip_version=IPVersion.All and same result.
I instantiate like this with ZeroConf.
Works OK in 0.31.0. Problem starts from 0.32.0
But at shutdown, this happens. Is it normal now in 0.33?
Tried with different
ip_version=IPVersion.Alland same result.