Bug 253608 - hostapd 100% CPU usage after WiFi device disappears
Summary: hostapd 100% CPU usage after WiFi device disappears
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: 12.2-STABLE
Hardware: arm64 Any
: --- Affects Some People
Assignee: freebsd-wireless (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-18 01:13 UTC by Damjan Jovanovic
Modified: 2021-02-18 01:13 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Damjan Jovanovic 2021-02-18 01:13:31 UTC
Some other bug causes my USB bus to sporadically undergo some kind of reset, making all USB devices appear to disconnect and then reconnect.

One of my USB devices is a WiFi dongle, which hostapd is running with. When it disconnects, hostapd CPU usage jumps to 100%, and stays there until manually killed:

# truss -s 1024 -f -p 34705
34705: read(5,0x80121f2c0,524288)		 ERR#6 'Device not configured'
34705: select(7,{ 4 5 6 },{ },{ },{ 2.635212 })	 = 1 (0x1)
34705: read(5,0x80121f2c0,524288)		 ERR#6 'Device not configured'
34705: select(7,{ 4 5 6 },{ },{ },{ 2.635171 })	 = 1 (0x1)
34705: read(5,0x80121f2c0,524288)		 ERR#6 'Device not configured'
34705: select(7,{ 4 5 6 },{ },{ },{ 2.635120 })	 = 1 (0x1)
34705: read(5,0x80121f2c0,524288)		 ERR#6 'Device not configured'
34705: select(7,{ 4 5 6 },{ },{ },{ 2.635069 })	 = 1 (0x1)
34705: read(5,0x80121f2c0,524288)		 ERR#6 'Device not configured'
34705: select(7,{ 4 5 6 },{ },{ },{ 2.635001 })	 = 1 (0x1)

# lsof -n |grep hostapd
hostapd   34705       root  cwd     VDIR 2669942718,3349274250                 36       4 /
hostapd   34705       root  rtd     VDIR 2669942718,3349274250                 36       4 /
hostapd   34705       root    0u    VCHR                  0,16                0t0      16 /dev/null
hostapd   34705       root    1u    VCHR                  0,16                0t0      16 /dev/null
hostapd   34705       root    2u    VCHR                  0,16                0t0      16 /dev/null
hostapd   34705       root    3u    IPv4    0xfffff80016a2b040                0t0     UDP *:*
hostapd   34705       root    4u     rte    0xfffff8001334b1e0                0t0         
hostapd   34705       root    5u    VCHR                  0,40                0t0      40 /dev/bpf
hostapd   34705       root    6u    unix    0xfffff8011139e000                0t0         /var/run/hostapd/wlan0
hostapd   34705       root    7r    VDIR 2669942718,3349274250                 43     712 /var/run
hostapd   34705       root    8w    VREG 2669942718,3349274250                  5  262304 /var/run/hostapd.pid


I consider this a hostapd bug, because the WiFi dongle could also get unplugged manually to reproduce it.

When a WiFi device disappears, hostapd should do something better than get stuck in an infinite loop.