Skip to content

Conversation

jstasiak
Copy link
Collaborator

@jstasiak jstasiak commented Apr 3, 2020

The assertions, added in [1] and modified in [2] introduced a
regression. When browsing in the presence of devices advertising SRV
records not marked as unique there would be an undesired crash (from [3]):

Exception in thread zeroconf-ServiceBrowser__hap._tcp.local.:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/home/pi/homekit-debugging/venv/lib/python3.7/site-packages/zeroconf/__init__.py", line 1504, in run
    handler(self.zc)
  File "/home/pi/homekit-debugging/venv/lib/python3.7/site-packages/zeroconf/__init__.py", line 1444, in <lambda>
    zeroconf=zeroconf, service_type=self.type, name=name, state_change=state_change
  File "/home/pi/homekit-debugging/venv/lib/python3.7/site-packages/zeroconf/__init__.py", line 1322, in fire
    h(**kwargs)
  File "browser.py", line 20, in on_service_state_change
    info = zeroconf.get_service_info(service_type, name)
  File "/home/pi/homekit-debugging/venv/lib/python3.7/site-packages/zeroconf/__init__.py", line 2191, in get_service_info
    if info.request(self, timeout):
  File "/home/pi/homekit-debugging/venv/lib/python3.7/site-packages/zeroconf/__init__.py", line 1762, in request
    out.add_answer_at_time(zc.cache.get_by_details(self.name, _TYPE_SRV, _CLASS_IN), now)
  File "/home/pi/homekit-debugging/venv/lib/python3.7/site-packages/zeroconf/__init__.py", line 907, in add_answer_at_time
    assert record.unique
AssertionError

The intention is to bring those assertions back in a way that only
enforces uniqueness when sending records, not when receiving them.

[1] bef8f59 ("Ensure all TXT, SRV, A records are unique")
[2] 5e4f496 ("Refactor out unique assertion")
[3] #236

The assertions, added in [1] and modified in [2] introduced a
regression. When browsing in the presence of devices advertising SRV
records not marked as unique there would be an undesired crash (from [3]):

    Exception in thread zeroconf-ServiceBrowser__hap._tcp.local.:
    Traceback (most recent call last):
      File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
        self.run()
      File "/home/pi/homekit-debugging/venv/lib/python3.7/site-packages/zeroconf/__init__.py", line 1504, in run
        handler(self.zc)
      File "/home/pi/homekit-debugging/venv/lib/python3.7/site-packages/zeroconf/__init__.py", line 1444, in <lambda>
        zeroconf=zeroconf, service_type=self.type, name=name, state_change=state_change
      File "/home/pi/homekit-debugging/venv/lib/python3.7/site-packages/zeroconf/__init__.py", line 1322, in fire
        h(**kwargs)
      File "browser.py", line 20, in on_service_state_change
        info = zeroconf.get_service_info(service_type, name)
      File "/home/pi/homekit-debugging/venv/lib/python3.7/site-packages/zeroconf/__init__.py", line 2191, in get_service_info
        if info.request(self, timeout):
      File "/home/pi/homekit-debugging/venv/lib/python3.7/site-packages/zeroconf/__init__.py", line 1762, in request
        out.add_answer_at_time(zc.cache.get_by_details(self.name, _TYPE_SRV, _CLASS_IN), now)
      File "/home/pi/homekit-debugging/venv/lib/python3.7/site-packages/zeroconf/__init__.py", line 907, in add_answer_at_time
        assert record.unique
    AssertionError

The intention is to bring those assertions back in a way that only
enforces uniqueness when sending records, not when receiving them.

[1] bef8f59 ("Ensure all TXT, SRV, A records are unique")
[2] 5e4f496 ("Refactor out unique assertion")
[3] #236
@coveralls
Copy link

coveralls commented Apr 3, 2020

Coverage Status

Coverage decreased (-0.06%) to 93.817% when pulling fdb803b on fix-unique-regression into 8e3adf8 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 93.728% when pulling fdb803b on fix-unique-regression into 8e3adf8 on master.

@jstasiak jstasiak merged commit a79015e into master Apr 3, 2020
@jstasiak jstasiak deleted the fix-unique-regression branch April 3, 2020 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants