openhab-core icon indicating copy to clipboard operation
openhab-core copied to clipboard

Openhab floods network with mdns

Open euphi opened this issue 6 months ago • 3 comments

  • Platform information:
    • Hardware: Opi5 Ultra
    • OS: dietPI
    • Java Runtime Environment: openjdk 17.0.15
    • openHAB version: 4.3.5
  • Issue of the topic: openhab floods network with mdns queries

Expected Behavior

openhab behaves well and does not flood my network

Current Behavior

openhab spams so much mdns queries that it kicks out wifi clients.

Steps to Reproduce (for Bugs)

  1. I setup a new SBC as homeserver. Everything was workinjg fine in the beginning
  2. Configuring openhab (adding bindings/things etc.). Some already work fine.
  3. Adding matter add-on, create Matter controller thing and unsuccessfully tried to add a matter node (tasmota with matter activated)

--> I noticed that suddenly network (wifi) became unreliable and that openhab used too much CPU (around 150% minimum).Stopping openhab makes network reliable again.

  1. I removed the matter related things and the addon.
  2. Several Restart of openhab and several reboots of the whole system

--> network is still flooded.

Note: I removed matter add-on and related things. It may be a coincidence that the problem started at the same time. However, if I stop openhab or stop the mdns bundles, the network is not flooded. So openhab is definitely the culprit here.

tcpdump with short example (note the timestamps that this is a window of 17ms only):

11:55:15.000646 IP 192.168.0.242.mdns > mdns.mcast.net.mdns: 0 AAAA (QM)? C049EF8DABD0.local. (36)
11:55:15.001010 IP6 fe80::820c:f9ff:fec8:c271.mdns > ff02::fb.mdns: 0 AAAA (QM)? C049EF8DABD0.local. (36)
11:55:15.001580 IP 192.168.0.242.mdns > mdns.mcast.net.mdns: 0 AAAA (QM)? C049EF8DABD0.local. (36)
11:55:15.001736 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.002694 IP6 fe80::820c:f9ff:fec8:c271.mdns > ff02::fb.mdns: 0 AAAA (QM)? C049EF8DABD0.local. (36)
11:55:15.002712 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.003000 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.003159 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.003359 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.003575 IP 192.168.0.242.mdns > mdns.mcast.net.mdns: 0 AAAA (QM)? C049EF8DABD0.local. (36)
11:55:15.003745 IP6 fe80::820c:f9ff:fec8:c271.mdns > ff02::fb.mdns: 0 AAAA (QM)? C049EF8DABD0.local. (36)
11:55:15.003955 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.004609 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.004810 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.004960 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.006200 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.006216 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.006255 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.006290 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.007396 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.007443 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.008553 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.009328 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.009381 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.009431 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.009775 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.010674 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.010994 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.011104 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.011202 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.011352 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.011982 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.012142 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.014385 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.014552 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.015657 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.015809 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.015879 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.016042 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.016195 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.016360 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.016416 IP 192.168.0.242.mdns > mdns.mcast.net.mdns: 0 AAAA (QM)? C049EF8DABD0.local. (36)
11:55:15.016525 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.016608 IP6 fe80::820c:f9ff:fec8:c271.mdns > ff02::fb.mdns: 0 AAAA (QM)? C049EF8DABD0.local. (36)
11:55:15.016690 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d:0:7887:a8ff:fe02:feb8 (86)
11:55:15.016767 IP 192.168.0.242.mdns > mdns.mcast.net.mdns: 0 AAAA (QM)? C049EF8DABD0.local. (36)
11:55:15.016933 IP6 fe80::820c:f9ff:fec8:c271.mdns > ff02::fb.mdns: 0 AAAA (QM)? C049EF8DABD0.local. (36)
11:55:15.017067 IP 192.168.0.242.mdns > mdns.mcast.net.mdns: 0 AAAA (QM)? C049EF8DABD0.local. (36)
11:55:15.017082 IP6 fe80::7887:a8ff:fe02:feb8.mdns > ff02::fb.mdns: 0*- [0q] 1/0/0 (Cache flush) AAAA fd7a:d212:312d::ffe5 (55)
11:55:15.017201 IP6 fe80::820c:f9ff:fec8:c271.mdns > ff02::fb.mdns: 0 AAAA (QM)? C049EF8DABD0.local. (36)

Ugly workaround:

As a quick fix, I stopped two of the bundles related to mDNS:

openhab> bundle:list | grep -i mdns
 58 │ Active   │  80 │ 3.5.12                │ JmDNS
172 │ Waiting  │  80 │ 4.3.5                 │ openHAB Core :: Bundles :: Configuration mDNS Discovery
187 │ Resolved │  80 │ 4.3.5                 │ openHAB Core :: Bundles :: REST mDNS Announcer
194 │ Resolved │  80 │ 4.3.5                 │ openHAB Core :: Bundles :: mDNS Service
258 │ Waiting  │  80 │ 4.3.5                 │ openHAB Core :: Bundles :: Configuration USB-Serial Discovery using ser2net mDNS scanning
265 │ Waiting  │  80 │ 4.3.5                 │ openHAB Core :: Bundles :: mDNS Suggested Add-on Finder

euphi avatar May 31 '25 10:05 euphi

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/openhab-floods-network-with-mdns/164313/2

openhab-bot avatar May 31 '25 10:05 openhab-bot

After restart some days later, the problem disappeared. So probably there was some cached request somewhere that then expired?

euphi avatar Jun 03 '25 20:06 euphi

I have no idea, but the matter binding does not use the built in openHAB MDNS so disabling those bundles from core would not have affected it, so i don't think its related to the binding.

digitaldan avatar Jun 03 '25 21:06 digitaldan

I think it was an indirect effect.

I wonder about:

11:55:15.003575 IP 192.168.0.242.mdns > mdns.mcast.net.mdns: 0 AAAA (QM)? C049EF8DABD0.local. (36) These requests also only occured during "the flood" and are send by a Fire TV stick.

euphi avatar Jun 26 '25 20:06 euphi

If the culprit was your Fire TV stick, please close the issue.

lolodomo avatar Jul 11 '25 03:07 lolodomo

Did you also install the network binding ? @Nadahar while checking the code of this binding discovered that it could potentially flood the network with mDNS traffic.

lolodomo avatar Aug 30 '25 08:08 lolodomo

This could also be the binding suggestion service through mDNS that triggers a lot of mDNS requests. There is a fix in progress that will allow to properly disable it at OH startup. You can follow PR #5042 .

lolodomo avatar Oct 05 '25 09:10 lolodomo

the matter binding does not use the built in openHAB MDNS

This is often a problem. Why doesn't it? There really shouldn't be more than one mDNS instance on any specific IP address, it leads to chaos as both instances will receive all messages from other devices, and both will give, often contradictory, answers.

@euphi We just had another case of "mDNS problems" that turned out to not really be a problem with OH at all: https://github.com/openhab/openhab-addons/issues/19399#issuecomment-3347513145

You don't say much about your environment, do you have routers that "forward" multicast that might end up duplicating messages or cause other problems? Do you have other services utilizing mDNS on the same host as OH is running?

Also, the Chromecast binding, if you use it, runs its own instance of mDNS, which can cause similar issues.

Nadahar avatar Oct 05 '25 12:10 Nadahar