home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.23k stars 30.58k forks source link

Zeroconf error - even though zeroconf not in my setup #30787

Closed point-4ward closed 3 years ago

point-4ward commented 4 years ago

Home Assistant release with the issue: 103.6

Last working Home Assistant release (if known): Not seen this before today, have had 103.6 installed since the day it was released

Operating environment (Hass.io/Docker/Windows/etc.): Hassio >Docker > Debian > Proxmox

Integration: Zeroconf

Description of problem: Error in log at startup as below

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant): N/A - zeroconf isn't in my config (I don't use default_config - so I guess it must be a dependency of something else I'm using but I don't know what??)

Traceback (if applicable):

2020-01-15 13:09:27 WARNING (zeroconf-Engine) [zeroconf] Choked at offset 0 while unpacking b'\n\xba\x10\x00'
2020-01-15 13:09:27 WARNING (zeroconf-Engine) [zeroconf] Exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 690, in __init__
    self.read_header()
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 713, in read_header
    ) = self.unpack(b'!6H')
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 700, in unpack
    info = struct.unpack(format_, self.data[self.offset : self.offset + length])
struct.error: unpack requires a buffer of 12 bytes
probot-home-assistant[bot] commented 4 years ago

Hey there @robbiet480, @Kane610, mind taking a look at this issue as its been labeled with a integration (zeroconf) you are listed as a codeowner for? Thanks!

Kane610 commented 4 years ago

What are you running?

point-4ward commented 4 years ago

Define?

Kane610 commented 4 years ago

What integrations are you running, if you think there is a dependency

point-4ward commented 4 years ago

I don't know if there's a dependency - if there isn't then that's a worry in itself that it's being loaded without being included.

Is there an easy way to pull all my integrations and platforms these days? Used to be on the info page in developer tools but it's gone now.

Or is there an easy way to find out what integrations and platforms depend on zeroconf and I can say which ones I use?

Otherwise it's going to take me a longwhile to go through everything and copy and paste it into a list :worried:

Kane610 commented 4 years ago

You can see everything loaded in the logs, I don't know if there is any Gui element that will tell you

point-4ward commented 4 years ago

Not in my homeassistant log. If I watch the docker log there's a mad flurry at the start of it preloading every integration that exists, but that's not going to help as I obviously don't use all of them. Unless you're telling me that the preloading is installing them every time? But then it can't be otherwise I would have had the scene.create service even though I didn't have scenes in my configuration recently and had to add it so I could play with it.

NvrBst commented 4 years ago

I'm running 0.104.2, and have the same error. The error has been here for at least a month though. Same binary blob as the initial poster for me too. "b'\n\xba\x10\x00'".

2020-01-19 13:55:30 WARNING (zeroconf-Engine) [zeroconf] Choked at offset 0 while unpacking b'\n\xba\x10\x00'
2020-01-19 13:55:30 WARNING (zeroconf-Engine) [zeroconf] Exception occurred:
Traceback (most recent call last):
  File "c:\homeassistant\lib\site-packages\zeroconf\__init__.py", line 709, in __init__
    self.read_header()
  File "c:\homeassistant\lib\site-packages\zeroconf\__init__.py", line 732, in read_header
    ) = self.unpack(b'!6H')
  File "c:\homeassistant\lib\site-packages\zeroconf\__init__.py", line 719, in unpack
    info = struct.unpack(format_, self.data[self.offset : self.offset + length])
struct.error: unpack requires a buffer of 12 bytes

Integrations I've been running are: Plex, Google Cast, TP-Link, Homekit: Climate.

point-4ward commented 4 years ago

Only match here is tp-link, but I run lots lots more.

lowgoz commented 4 years ago

Im running Tp-link switches as well and am getting same.

`Exception occurred: 7:49 PM /usr/local/lib/python3.7/site-packages/zeroconf/init.py (WARNING) Choked at offset 0 while unpacking b'\n\xba\x10\x00'

7:49 PM /usr/local/lib/python3.7/site-packages/zeroconf/init.py (WARNING) Could not read state for 192.168.1.37: Communication error

7:46 PM components/tplink/switch.py (WARNING) - message first occurred at 7:40 PM and shows up 3 times`

Switch toggles on/off when error occurs as well.

point-4ward commented 4 years ago

https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/tplink/manifest.json

Suggests that zeroconf isnt a dependency for tp-link, so its appears that something tp-link is doing is interfering with something else that has zeroconf as a dependency based on the information so far.

:confused:

timdonovanuk commented 4 years ago

Same here, after adding tplink to my config!

pmthomps commented 4 years ago

Same issue. Tplink is one of the few non-default integrations that I added. It's configured with auto-discovery. It's interrupting the discovery of some existing tplink devices.

arch aarch64
dev false
docker true
hassio true
os_name Linux
python_version 3.7.6
timezone America/Los_Angeles
version 0.106.5
virtualenv false
point-4ward commented 4 years ago

Ooooh, forgot to update this issue. It's definitely tp-link. I had a massive refurb downstairs a few weeks ago and had to go offline.

When I hooked everything back up I didn't reinstall the tp-link sockets straight away as I was in a hurry and just needed the essentials back online.

As soon as I put them back in, I got this error message.

So, if someone can change/add the tag to tp-link please and notify the code owner, that would be ace :slightly_smiling_face:

Kane610 commented 4 years ago

@mf-social the problem is still in the zeroconf library, not in the tp-link library

point-4ward commented 4 years ago

@Kane610 - yup, but zeroconf is not a dependency for tp-link, so something tp-link is doing is interfering with the zeroconf service. I don't think trying to sort out both ends of the problem is an unreasonable idea.

Pirol62 commented 4 years ago

I do have this error as well fom time to time (at least once a day mostly during the night)

Logger: zeroconf
Source: /usr/local/lib/python3.7/site-packages/zeroconf/__init__.py:365
First occurred: 1:41:59 (1 occurrences)
Last logged: 1:41:59

Choked at offset 0 while unpacking b'\n\xba\x10\x00'

and then next:

Logger: zeroconf
Source: /usr/local/lib/python3.7/site-packages/zeroconf/__init__.py:366
First occurred: 1:41:59 (1 occurrences)
Last logged: 1:41:59

Exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 713, in __init__
    self.read_header()
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 736, in read_header
    ) = self.unpack(b'!6H')
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 723, in unpack
    info = struct.unpack(format_, self.data[self.offset : self.offset + length])
struct.error: unpack requires a buffer of 12 bytes

I run hassio 107.7 on rasp 3+ TP-Link - 2 switches

bdraco commented 4 years ago

The following integrations are using Zeroconf:

bdraco commented 4 years ago

zeroconf already traps these exceptions in DNSIncoming so it shouldn't cause any issues other than an annoying warning in the log.

        try:
            self.read_header()
            self.read_questions()
            self.read_others()
            self.valid = True

        except (IndexError, struct.error, IncomingDecodeError):
            self.log_exception_warning(('Choked at offset %d while unpacking %r', self.offset, data))

Is this actually causing an a visible issue other than the log spam?

CoreyVidal commented 4 years ago

I, too, have set zeroconfig default_interface: true, have tp-link, and am getting the same errors:

2020-06-09 19:58:15 WARNING (zeroconf-Engine-140231346141984) [zeroconf] Choked at offset 0 while unpacking b'\n\xba\x10\x00'
2020-06-09 19:58:15 WARNING (zeroconf-Engine-140231346141984) [zeroconf] Exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 714, in __init__
    self.read_header()
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 751, in read_header
    ) = self.unpack(b'!6H')
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 738, in unpack
    info = struct.unpack(format_, self.data[self.offset : self.offset + length])
struct.error: unpack requires a buffer of 12 bytes
mcfrojd commented 4 years ago

I get this zeroconf error but it seems to be from Tradfri Gateway Not sure if it started when i re-added the gateway a week ago, or if it came after any update (core or supervisor) I am running Deconz to, i had to add the gateway back to make Fyrtur covers to work.

Logger: zeroconf
Source: /usr/local/lib/python3.7/site-packages/zeroconf/__init__.py:365
First occurred: 16:58:33 (1 occurrences)
Last logged: 16:58:33

Choked at offset 380 while unpacking b'\x00\x00\x84\x00\x00\x00\x00\x05\x00\x00\x00\x00\x04_hap\x04_tcp\x05local\x00\x00\x0c\x00\x01\x00\x00\x11\x94\x00!\x0fTRADFRI gateway\x04_hap\x04_tcp\x05local\x00\x0fTRADFRI gateway\x04_hap\x04_tcp\x05local\x00\x00\x10\x80\x01\x00\x00\x11\x94\x00T\x04c#=2\x04ff=1\x14id=B4:37:8A:B7:96:46\x12md=TRADFRI gateway\x06pv=1.1\x04s#=1\x04sf=1\x04ci=2\x0bsh=J5dBEg==\x0fTRADFRI gateway\x04_hap\x04_tcp\x05local\x00\x00!\x80\x01\x00\x00\x00x\x00\x08\x00\x00\x00\x00\x00P\x00\x00\x00\x00\x00\x01\x80\x01\x00\x00\x00x\x00\x04\xc0\xa8o\xda\x00\x00\x00\x1c\x80\x01\x00\x00\x00\x00\x00\x10\x00\xf0>\xb0z\x80\x12\xeaz\x80\x12\xeaz\x80\x12\xea'
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 706, in __init__
    self.read_others()
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 777, in read_others
    domain = self.read_name()
  File "/usr/local/lib/python3.7/site-packages/zeroconf/__init__.py", line 838, in read_name
    length = self.data[off]
IndexError: index out of range
stowers95120 commented 4 years ago

I get this zeroconf error and in addition all my TP-Link switches have disappeared (and rerunning the integration just says it can't discover any TP-Link devices and aborts).

RogerSelwyn commented 4 years ago

I'm not running TP-Link, but just started getting these errors after upgrade to 0.112.0

b0kar commented 4 years ago

Had the same problem with TP-Link integration this morning Root cause was that the IP address defined for this device in configuration.yaml had changed because of expired dhcp lease and it was used by another device (non tp-link). Resolved by assigning fixed IP address to the tp-link devices matching the one defined in configuration.yaml

TomBrandt commented 4 years ago

Had the same problem with TP-Link integration this Today I agrees that the IP address is the problem. Fix through Router assigning Static IP Address. Also I have found that entries for each TPlink device in Configuration.yaml Solves the HS100 TPlink Switches being occasionally unavailable after a restart of Home Assistant.

blamaz commented 4 years ago

Also getting this error after upgrading to 0.113.0

Logger: zeroconf Source: /usr/local/lib/python3.8/site-packages/zeroconf/init.py:365 First occurred: 23 juillet 2020 à 22:14:47 (1 occurrences) Last logged: 23 juillet 2020 à 22:14:47

Choked at offset 109 while unpacking b'\x00\x00\x84\x00\x00\x00\x00\x04\x00\x00\x00\x01\x00\x00\x0c\x00\x01\x00\x00\x01,\x00\x04\x02\x880\x00\x02\x880\x00\x00!\x80\x01\x00\x00\x01,\x00\x0b\xf3\x08\x80\xef\xf3\t\x03\x81rF\x00\nMyQ-8FD-34\x05local\x00\x00\x01\x80\x01\x00\x00\x01,\x00\x04\xc0\xa8\x01o\x02\x880\x00\x00/\x80\x01\x00\x00\x01,\x00\x0b\x02\x880\x00\x00\x05\x00\x08\x00\x00@' Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/zeroconf/init.py", line 706, in init self.read_others() File "/usr/local/lib/python3.8/site-packages/zeroconf/init.py", line 777, in read_others domain = self.read_name() File "/usr/local/lib/python3.8/site-packages/zeroconf/init.py", line 838, in read_name length = self.data[off] IndexError: index out of range

LukasQ commented 4 years ago

same here in 0.114.0. I receive zeroconf errors with a TRADFRI string, but already deleted the integration. No TP link, no cast integration.

jhanvipandyacom commented 4 years ago

Any solution to this trouble?

I have TP-Link bulbs and they are in HomeKit. Get the same error. Also, one of the bulb doesn’t respond to Siri, however all the tplink stuff responds as usual.

jokerigno commented 4 years ago

I have this warning message related to Zeroconf too:

_Detected code that attempted to create another Zeroconf instance. Please use the shared Zeroconf via await homeassistant.components.zeroconf.async_getinstance(hass). Please report this issue.

I do run a tp link integration

blamaz commented 4 years ago

Still having this issue but II don't run a tp link integration

bdraco commented 4 years ago

https://github.com/jstasiak/python-zeroconf/issues/308

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.