Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mDNS discovery dramaticaly decrease wi-fi performance on linux host #1712

Closed
1 task done
bvasiliev opened this issue Mar 5, 2024 · 3 comments
Closed
1 task done
Labels
needs investigation Further testing is required

Comments

@bvasiliev
Copy link

bvasiliev commented Mar 5, 2024

  • I confirm that this is an issue rather than a question.

Bug report

Hyperion with ENABLE_MDNS option forces a local connetcion manager (connmand in my case) to scan wi-fi radio network every 10 seconds. Network scan switches wireless adapter to slowest basic rate on TX, which significantly slows down all TCP connections on a system, flappening every 10 seconds.

This significantly slows down media streaming or network file systems over wi-fi.

Steps to reproduce

I use hyperion on Vero 4k box with flatbuffer forwarding to another hyperion instance over IP network.

To reproduce run Hypeyperion with ENABLE_MDNS on Debian 11 bullseye aarch64 with connmand connection manager (OSMC on Vero 4k).

What is expected?

Working mDNS services discovery without scanning wi-fi radio network, like other mdns-enabled apps.

What is actually happening?

After hyperion start RX rate on wi-fi access point for associated hyperion host drops to 6.0 MBit/s every 10 seconds.

CC:B8:A8:00:00:00  -47 dBm / -106 dBm (SNR 59)  120 ms ago
        RX: 6.0 MBit/s
        TX: 433.3 MBit/s, VHT-MCS 9, 80MHz, VHT-NSS 1 

On the host:

osmc@vero:~$ dmesg
...
[42385.506828] wl_run_escan: LEGACY_SCAN sync ID: 4181, bssidx: 0
[42395.507251] wl_run_escan: LEGACY_SCAN sync ID: 4182, bssidx: 0
[42405.511234] wl_run_escan: LEGACY_SCAN sync ID: 4183, bssidx: 0
[42415.508891] wl_run_escan: LEGACY_SCAN sync ID: 4184, bssidx: 0
...

osmc@vero:~$ iwevent
Waiting for Wireless Events from interfaces...
06:24:29.019337   wlan0    Scan request completed
06:24:38.997234   wlan0    Scan request completed
06:24:48.993001   wlan0    Scan request completed
06:24:59.001065   wlan0    Scan request completed
...
osmc@vero:~$ sudo dbus-monitor --system
signal time=1709620245.830170 sender=org.freedesktop.DBus -> destination=:1.86 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcqui                                                red
   string ":1.86"
signal time=1709620245.830254 sender=org.freedesktop.DBus -> destination=:1.86 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
   string ":1.86"




signal time=1709620248.996887 sender=:1.2 -> destination=(null destination) serial=132717 path=/fi/w1/wpa_supplicant1/Interfaces/0; interface=fi.w1.wpa_supplicant1.                                                Interface; member=BSSRemoved
   object path "/fi/w1/wpa_supplicant1/Interfaces/0/BSSs/4845"
signal time=1709620248.996951 sender=:1.2 -> destination=(null destination) serial=132718 path=/fi/w1/wpa_supplicant1/Interfaces/0; interface=fi.w1.wpa_supplicant1.                                                Interface; member=BSSRemoved
   object path "/fi/w1/wpa_supplicant1/Interfaces/0/BSSs/4849"
signal time=1709620248.996978 sender=:1.2 -> destination=(null destination) serial=132719 path=/fi/w1/wpa_supplicant1/Interfaces/0; interface=fi.w1.wpa_supplicant1.                                                Interface; member=ScanDone
   boolean true
signal time=1709620248.998692 sender=:1.5 -> destination=(null destination) serial=49405 path=/; interface=org.freedesktop.DBus.ObjectManager; member=InterfacesRemo                                                ved
   object path "/net/connman/service/wifi_ccb8a8000000_4d5453526f757465722d323142353931_managed_psk"
   array [
      string "org.freedesktop.DBus.Introspectable"
      string "net.connman.Service"
   ]
method call time=1709620248.999608 sender=:1.5 -> destination=fi.w1.wpa_supplicant1 serial=49406 path=/fi/w1/wpa_supplicant1/Interfaces/0; interface=org.freedesktop                                                .DBus.Properties; member=Get
   string "fi.w1.wpa_supplicant1.Interface"
   string "BSSs"
signal time=1709620249.002472 sender=:1.2 -> destination=(null destination) serial=132720 path=/fi/w1/wpa_supplicant1/Interfaces/0; interface=org.freedesktop.DBus.P                                                roperties; member=PropertiesChanged
   string "fi.w1.wpa_supplicant1.Interface"
   array [
      dict entry(
         string "Scanning"
         variant             boolean false
      )

...

Stopping hyperion eliminates the problem and the network works fine.

System

Hyperion Server:
- Build:             (HEAD detached at a93d79ba) (Paulchen-Panther-cb85d2d7/a93d79ba-1705568419)
- Build time:        Feb  8 2024 00:02:58
- Git Remote:        https://github.com/hyperion-project/hyperion.ng.git
- Version:           2.0.16
- UI Lang:           en (BrowserLang: ru)
- UI Access:         expert
- Avail Screen Cap.: framebuffer,amlogic
- Avail Video  Cap.: v4l2
- Avail Audio  Cap.: 
- Avail Services:    boblight,cec,effectengine,forwarder,flatbuffer,protobuffer,mDNS,SSDP,borderdetection
- Config path:       /home/osmc/.hyperion
- Database:          read/write
- Mode:              Non-GUI

Hyperion Server OS:
- Distribution:      Open Source Media Center
- Architecture:      arm64
- CPU Hardware:      OSMC Vero 4K / Vero 4K +
- Kernel:            linux (4.9.269-44-osmc (WS: 32))
- Root/Admin:        false
- Qt Version:        5.15.2
- Python Version:    3.9.2
@Lord-Grey Lord-Grey added needs investigation Further testing is required and removed Waiting For Review labels Mar 5, 2024
@Lord-Grey
Copy link
Collaborator

We are making use of the qmdnsengine codebase for mDNS.
Qmdnsengine seems to check, if an interface can do multicast and if yes, it adds the socket to the multicast groups.

https://github.com/nitroshare/qmdnsengine/blob/4e54bc86c8ed2d4fa2e7449d4ba6a6a2742d9eb1/src/src/server.cpp#L103

Could you check, if you can disable the Wifi interface for multicast and if that has an effect that mDNS packages are not send?

@bvasiliev
Copy link
Author

I disabled multicast on wireless interface and restarted hyperion:

osmc@vero:~$ ip link show wlan0
3: wlan0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DORMANT group default qlen 1000
...
osmc@vero:~$ sudo ip link set multicast off dev wlan0

osmc@vero:~$ ip link show wlan0
3: wlan0: <BROADCAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DORMANT group default
...
osmc@vero:~$ sudo systemctl restart hyperion.service

But flappeninig with scans every 10 seconds remained unchanged.

I checked presence of mdns on interface after:

osmc@vero:~$ sudo tcpdump port 5353 -i wlan0
15:49:31.414512 IP vero.mdns > mdns.mcast.net.mdns: 0 [2a] PTR (QM)? _hyperiond-json._tcp.local. (87)
15:49:32.413951 IP vero.mdns > mdns.mcast.net.mdns: 0 [1a] PTR (QM)? _hyperiond-flatbuf._tcp.local. (71)
15:50:31.416413 IP vero.mdns > mdns.mcast.net.mdns: 0 [2a] PTR (QM)? _hyperiond-json._tcp.local. (87)
15:50:32.413618 IP vero.mdns > mdns.mcast.net.mdns: 0 [1a] PTR (QM)? _hyperiond-flatbuf._tcp.local. (71)

There are some packets, but not in 10 secons period. I've also checked all IP traffic on the interface including SSDP and didn't find any packets that matched 10 seconds interval or corellated with scan log events in dmesg.

Can hyperion interact with a host network in other ways like dbus or something?

@bvasiliev
Copy link
Author

The problem does not reproduces in the build with Qt6 instead of system's Qt5.

Also, the issue was not related to mDNS - turning it off had no effect. Perhaps the issue is related to QtNetwork in Qt5, SSDP(?), and the specific network stack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs investigation Further testing is required
Projects
None yet
Development

No branches or pull requests

2 participants