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

Number of wireless clients in AP mode is very limited #3010

Open
martignoni opened this issue Jun 11, 2019 · 39 comments
Open

Number of wireless clients in AP mode is very limited #3010

martignoni opened this issue Jun 11, 2019 · 39 comments

Comments

@martignoni
Copy link

@martignoni martignoni commented Jun 11, 2019

I'm reporting this on Jamesh's advice (see this forum discussion).

Describe the bug
On RPi 3B+, on can expect an optimistic max. of 20-30 devices connected simultaneously via Wi-Fi, even when no under-voltage event occurs.

To reproduce
Use case: the RPi serves as a wifi AP and a web server, that's all. No user is logged in the RPi in production use. An official Raspberry Foundation power supply and cable is used, so that no under-voltage event occurs.

Nginx and php-fpm are optimized so that memory is not a problem. Flooding the web server using ApacheBench shows that memory is not a problem: available memory remains at around 600M at any time, even with 100 concurrent http requests! Swap is never used.

The limitation experienced is uniquely caused by concurrent wifi connections to the AP (hostapd). For that reason, I'm suspecting it's a wifi driver issue.

Expected behaviour
More client devices than a mere 20 can be simultaneously connected to the RPi in AP mode.

Actual behaviour
When about 20 devices are connected to the RPi in AP mode, the RPi freezes.

System

  • Model: Pi3B+
  • OS and version: Raspberry Pi reference 2019-04-08
  • Firmware: version 2e98b31d18547962e564bdf88e57b3df7085c29b (clean) (release) (start_cd)
  • Kernel: Linux moodlebox 4.19.42-v7+ #1219 SMP Tue May 14 21:20:58 BST 2019 armv7l GNU/Linux

Logs
Not applicable.

Additional context
This is the content of my /etc/hostapd/hostapd.conf:

# Set country code
country_code=US
# Name of the Wi-Fi interface
interface=wlan0
# Use the nl80211 driver
driver=nl80211
# Wi-Fi network name (SSID)
ssid2=4d6f6f646c65426f78
utf8_ssid=1
# Show or hide SSID
ignore_broadcast_ssid=0
# Use the 2.4GHz band
hw_mode=g
# The Wi-Fi channel
channel=11
# Enable 802.11n
ieee80211n=1
# Enable WMM
wmm_enabled=1
# Enable 40 MHz channels with short guard interval for 20 Mhz
#ht_capab=[MAX-AMSDU-3839][HT40+][SHORT-GI-20][SHORT-GI-40][DSSS_CCK-40]
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
# Accept all MAC addresses
macaddr_acl=0
# Use WPA authentication
auth_algs=1
# Use WPA2
wpa=2
# Use a pre-shared key
wpa_key_mgmt=WPA-PSK
# The network passphrase
wpa_passphrase=moodlebox
# Use AES, instead of TKIP
rsn_pairwise=CCMP
# Enable hostapd_cli
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
@martignoni martignoni changed the title Wireless clients in AP mode is very limited Number of wireless clients in AP mode is very limited Jun 11, 2019
@Choupinounours
Copy link

@Choupinounours Choupinounours commented Jul 5, 2019

Mhhh I meet the same problem ! Could be really useful to fix it !

@marcusdiy
Copy link

@marcusdiy marcusdiy commented Jul 23, 2019

I can connect only 9 devices with RPi 3B+ ...

@marcusdiy
Copy link

@marcusdiy marcusdiy commented Jul 28, 2019

Seems like every time, before reaching the quota, there is like some kind undervoltage issue...

Jul 28 20:49:07 dnsmasq-dhcp[896]: DHCPACK(ap0) 10.3.141.110 xx:xx:xx:xx:xx:xx HUAWEI_P9_lite
Jul 28 20:49:12 spherae kernel: [ 440.556265] Under-voltage detected! (0x00050005)
Jul 28 20:49:16 spherae kernel: [ 444.716262] Voltage normalised (0x00000000)
Jul 28 20:49:21 dnsmasq-dhcp[896]: DHCPDISCOVER(ap0) xx:xx:xx:xx:xx:xx
Jul 28 20:49:21 dnsmasq-dhcp[896]: DHCPOFFER(ap0) 10.3.141.108 xx:xx:xx:xx:xx:xx
Jul 28 20:49:21 dnsmasq-dhcp[896]: DHCPREQUEST(ap0) 10.3.141.108 xx:xx:xx:xx:xx:xx
Jul 28 20:49:21 dnsmasq-dhcp[896]: DHCPACK(ap0) 10.3.141.108 xx:xx:xx:xx:xx:xx Galaxy-S7
Jul 28 20:50:48 spherae kernel: [ 536.727290] brcmfmac: send_key_to_dongle: wsec_key error (-52)

I'm using a duracell power bank rated for 2.4A, with no peripherals other than a LAN cable

@martignoni
Copy link
Author

@martignoni martignoni commented Jul 28, 2019

@marcusdiy You should absolutely be certain to use a adequate power supply and cable before any testing, so that not under-voltage issue occurs in these testing.

I'll edit my bug report to positively indicate that a limited number of clients occurs even when no under-voltage event occurs.

Edit: though, thank you for the confirmation that under-voltage has an drastic effect on the number of wireless clients

@christian-westphal
Copy link

@christian-westphal christian-westphal commented Jul 30, 2019

RPI is a very nice plateform for a lot of "boxes" (moodlebox, piratebox etc) so this resolution willy be very usefull...

Thanks

@marcusdiy
Copy link

@marcusdiy marcusdiy commented Aug 9, 2019

I were able to connect more than 20+ devices using ubuntu mate + snap wifi-ap
It is some kind of software limit that we got there...

@ghost
Copy link

@ghost ghost commented Nov 14, 2019

Any news about this?

I manage to get exactly 19 connections on a Rpi 3b and 14 connections on a Rpi 3b+ with the following hostapd conf on Raspbian Stretch:

interface=wlan0
driver=nl80211
ssid=xxxx
hw_mode=g
channel=7
macaddr_acl=0
auth_algs=3

I will soon proceed to new tests on Raspbian Buster.

@pelwell
Copy link
Contributor

@pelwell pelwell commented Nov 14, 2019

Both 43438 and 43455 are designed for "mobile or handheld wireless system[s]". As such, 19 and 14 sounds pretty good. I suspect they both have relatively small RAMs that also need to contain the firmware, so resources are going to be limited.

@leond08
Copy link

@leond08 leond08 commented Mar 9, 2020

any news about this?

@martignoni
Copy link
Author

@martignoni martignoni commented Aug 18, 2020

Some reports seem to indicate that the issue is worse on RPi 4 hardware, where max. number of wireless clients is sometimes less than 10!

Ref: https://discuss.moodlebox.net/d/198-wifi-client-advice/6

@ghost
Copy link

@ghost ghost commented Aug 18, 2020

Same results here, 8 devices connected with a Rapsberry Pi 4 on Buster... but same with a 3b+
Having a few Rapsberry Pi in production for more than a year now with hostapd, the real dropdown in number of users connected simultaneously was seen by upgrading from Stretch to Buster.

@fabrizioromanelli
Copy link

@fabrizioromanelli fabrizioromanelli commented Oct 10, 2020

Some reports seem to indicate that the issue is worse on RPi 4 hardware, where max. number of wireless clients is sometimes less than 10!

Ref: https://discuss.moodlebox.net/d/198-wifi-client-advice/6

In my case I have a Raspberry Pi 4, I have tried your same configuration for /etc/hostapd/hostapd.conf and can connect just 5 devices simultaneously. As soon as I disconnect a device, another one can connect without any problem. All the devices are in range.

@greenorca
Copy link

@greenorca greenorca commented Oct 13, 2020

Same problem here on Raspi4. Hostapd worked well when testing with 2 clients back home, failed utterly when using it in school during my Web-Dev class...

If there is any information I can provide to help solving this issue, pls let me know.
Many thanks!

@andrew-d-l-nelson
Copy link

@andrew-d-l-nelson andrew-d-l-nelson commented Oct 21, 2020

I have also just encountered this issue with a Raspi4 (both 4 and 8 GB ram) using Buster. Can't get more than 7 other raspis to connect... Also, I don't know if this is pertinent, but it seems like power save mode is automatically enabled for the brcm wifi driver. I saw in earlier iterations that this may cause clients to get dropped?

@brandonyb
Copy link

@brandonyb brandonyb commented Nov 4, 2020

I am using Raspberry Pi 4 (1 GB Ram), and only able to connect 1 client to it...

@guillain
Copy link

@guillain guillain commented Dec 19, 2020

Hi,

Same issue, no more than 8 devices connected in same time on Raspbian with RaspAP :(

  • Raspbian 3B+(5.4.79-v7+ #1373 2020 armv7l)
  • DC: Laboratory power supply (GPR-3030)
  • Devices: ESP (mainly 8266 and 32cam)
  • RaspAP (HostAP, dnsmask...) in AP mode only

Even if I can put some devices on sleep and wait events to wake up them, others devices need permanent connection (like the camera).

Apparently people have successfully connected close to 20 devices (my target for the number of device connected in same time).
https://raspberrypi.stackexchange.com/questions/50162/maximum-wi-fi-clients-on-pi-3-hotspot

Any idea/workaround to move forward ? because apparently this will not be fixed in 2020 ^^

Thanks and take care!

@pelwell
Copy link
Contributor

@pelwell pelwell commented Dec 19, 2020

I think there is no possibility of a "fix" - every change to the firmware (vulnerability patch, etc.) takes up more of the limited RAM, resulting in less space to host AP clients. If you really care about AP clients then you'll have to either use an old firmware or buy a USB dongle (which might give you higher performance as well).

@ziesemer
Copy link

@ziesemer ziesemer commented Dec 19, 2020

I think there is no possibility of a "fix" - every change to the firmware (vulnerability patch, etc.) takes up more of the limited RAM, resulting in less space to host AP clients.

Can we please clarify, is this system RAM, or RAM specific to the chipset / wireless chip? I.E., having a Pi with 1 vs. 8 GB of RAM doesn't seem to make any difference here?

@pelwell
Copy link
Contributor

@pelwell pelwell commented Dec 19, 2020

The RAM on the WiFi part, into which the firmware is loaded, and which is also used for the running state of the device.

@huan
Copy link

@huan huan commented Dec 20, 2020

buy a USB dongle (which might give you higher performance as well).

@pelwell using a USB dongle is considering an alternative solution for me.

Could you please share which USB dongle can handle more wifi clients, with brand and model specs?

Thank you very much!

Update

I have an answer on StackExchange for the question Maximum Wi-Fi clients on Pi

@ziesemer
Copy link

@ziesemer ziesemer commented Dec 23, 2020

Could you please to share which usb dongle can handle more wifi clients, with brand and model specs?

FYI, there is the reference at https://elinux.org/RPi_USB_Wi-Fi_Adapters . It would be nice to see included a number of supported WiFi clients, etc. - might be a good place to start. Would also be nice to have a cross-reference as to which support various features such as which wireless bands and WiFi versions are supported in AP mode, which support external antennas, etc.

I previously had high hopes of using a "utility" Pi that I carry in my bag as a "can meet any need" device. Given these issues, I had to also include a separate "travel router" for serving as an AP. It easily serves 12+ WiFi clients, but the CPU was lacking for NAT + routing. I could use the 2 together, and use the travel router as just a "dumb AP", and then let the Pi do the rest of the networking - but it would be nice to consolidate this all together.

I'm also interested in any specific product recommendations here.

@guillain
Copy link

@guillain guillain commented Dec 23, 2020

Yep,

Since my message I've buyed the USB key BossTrend AC1200 based on the chipset RTL8812AU and now I've ~15 devices connected without issue.

It works like a charm with the driver https://github.com/cilynx/rtl88x2bu.git.
Just one thing to monitor, after reboot an high process consumption:

  • RTW_CMD_THREAD
  • writing commands to Realtek-based network devices
  • ~25% of CPU
  • 2/3 minutes

If I've new I'll let you know there.

Enjoy and take care.

@ericbeaudry
Copy link

@ericbeaudry ericbeaudry commented Dec 23, 2020

buy a USB dongle (which might give you higher performance as well).

@pelwell using a usb dongle is considering an alternative solution for me.

Could you please to share which usb dongle can handle more wifi clients, with brand and model specs?

Thank you very much!

Got hit by that new limitation too. The maximum Wifi connection I've reached on a Pi4 is 7 as opposed to about 30 on a Pi3 18 months ago. I have no idea where and why that limitation got added but it's rendering the Pi pretty useless in my scenario.
On the bright side, I ordered a couple of external antennas with the RT5370 chipset (no driver to install with this chipset) and the first I plugged in is already sustaining 21 steady connections. I intend to push and see the limit in the next couple of days. Here's the antenna that looks promising RT5370 Antenna

@ziesemer
Copy link

@ziesemer ziesemer commented Dec 23, 2020

@guillain and @ericbeaudry - Could each of you please share which Pi and OS versions you are seeing your latest results with?

@guillain
Copy link

@guillain guillain commented Dec 23, 2020

Hi Ziesemer,
You've it there: #3010 (comment)

@martignoni
Copy link
Author

@martignoni martignoni commented Dec 23, 2020

@ericbeaudry says:

Got hit by that new limitation too. The maximum Wifi connection I've reached on a Pi4 is 7 as opposed to about 30 on a Pi3 18 months ago.

This leads to think there's indeed something wrong either in Pi4 hardware or in Raspberry Pi OS or drivers (which is the purpose of this issue). Humbly suggesting we stick to this, and talk about dongles elsewhere (e.g. on RPi forums).

@ziesemer: I'm getting poor results with RPi4 since many versions of Raspberry Pi OS, and disappointing results with RPi 3B too (see #3010 (comment)). But I could not test on a large scale if the new wifi drivers shipped with last image (version 2020-12-02) have changed anything. I'd be glad to have some feedback about this.

@ericbeaudry
Copy link

@ericbeaudry ericbeaudry commented Dec 23, 2020

@ericbeaudry says:

Got hit by that new limitation too. The maximum Wifi connection I've reached on a Pi4 is 7 as opposed to about 30 on a Pi3 18 months ago.

This leads to think there's indeed something wrong either in Pi4 hardware or in Raspberry Pi OS or drivers (which is the purpose of this issue). Humbly suggesting we stick to this, and talk about dongles elsewhere (e.g. on RPi forums).

@ziesemer: I'm getting poor results with RPi4 since many versions of Raspberry Pi OS, and disappointing results with RPi 3B too (see #3010 (comment)). But I could not test on a large scale if the new wifi drivers shipped with last image (version 2020-12-02) have changed anything. I'd be glad to have some feedback about this.

Agreed! Still the fact that an external RT5370 is capable of handling over 21 (3 times more) simultaneous Wifi clients is "interesting" to say the least.

I'm also having the issue on a clean install of ubuntu 20.04. The 7th wifi client was crashing the Wifi interface for good and required a reboot. Following the instructions provided #3849. I replaced the firmware with the one provided by Cypress and now the 7th client is not crashing the wifi interface anymore but I'm still unable to add more than 7 clients. Disconnecting one, opens up a slot that gets used by the next device requesting a connection.

Hopefully someone with a deeper understanding of the wifi stack common to both raspbian and ubuntu will be able to dig a bit more and find the culprit.

@waiter21
Copy link

@waiter21 waiter21 commented Jan 1, 2021

I found this thread as I'm experiencing exactly the same thing. I'm running a Rpi3 B+as an access point. I can connect 7 devices. When I attempt to connect an 8th device, the wifi crashes, all 7 devices that were connected are kicked off, and I need to reboot to recover.

The devices connecting are low bandwidth, ESP32 sensors, transferring MQTT data to a Mosquito server on the same Pi as the AP.

I'm following for any resolution. I can also help with this issue, but I'm nowhere near tech savey on the Rpi as many of you.

@ericbeaudry
Copy link

@ericbeaudry ericbeaudry commented Jan 2, 2021

I found this thread as I'm experiencing exactly the same thing. I'm running a Rpi3 B+as an access point. I can connect 7 devices. When I attempt to connect an 8th device, the wifi crashes, all 7 devices that were connected are kicked off, and I need to reboot to recover.

The devices connecting are low bandwidth, ESP32 sensors, transferring MQTT data to a Mosquito server on the same Pi as the AP.

I'm following for any resolution. I can also help with this issue, but I'm nowhere near tech savey on the Rpi as many of you.

The procedure describe in #3849 helps in mitigating the crashes. It won't give you more connections but at least your Pi won't need a reboot every time you get more than 7 clients. Since this issue doesn't seem to attract much attention, I personally decided to dump the onboard WiFi and go with an external antenna. It has proven rock solid for 10 days now in a setup pretty similar to yours. A bunch of sensors sending telemetry over MQTT hosted on the Pi itself.

@pelwell
Copy link
Contributor

@pelwell pelwell commented Jan 2, 2021

The firmware files don't contain the whole image, but rather patches to the built-in ROM image. This means that every change takes up more of the limited patch RAM. The only way to get more free RAM, and hence more clients, is to revert to older firmware with more bugs and vulnerabilities.

@ericbeaudry
Copy link

@ericbeaudry ericbeaudry commented Jan 2, 2021

So you're saying that this is by design and nothing (other than reverting to older firmware) can be done. This is a rather chocking revelation. If this is the case, why is the issue still open 6 months later? Can it be documented properly and closed so people stop wasting time trying to make this work?

@waiter21
Copy link

@waiter21 waiter21 commented Jan 2, 2021

I downloaded fw_test_fix.bin (617k).

I assume this will also work on a Rpi 3 B+

Next question, I'm not exactly sure how to implement/make the changes. I'm a little apprehensive about attempting to do this without knowing what I'm doing. Is there a How-To on how to make these firmware updates?

@ericbeaudry
Copy link

@ericbeaudry ericbeaudry commented Jan 2, 2021

I downloaded fw_test_fix.bin (617k).

I assume this will also work on a Rpi 3 B+

Next question, I'm not exactly sure how to implement/make the changes. I'm a little apprehensive about attempting to do this without knowing what I'm doing. Is there a How-To on how to make these firmware updates?

I'm no expert either. So I simply followed the steps provided by pelwell on dec 1st #3849 (comment)

Maybe give him a moment to get back to you before attempting this procedure. He definitely knows a lot more than us!

@waiter21
Copy link

@waiter21 waiter21 commented Jan 2, 2021

OK, Thanks. 7 clients is workable for now. I discovered this problem when I also connected my smartphone so I could monitor MQTT messages.

I also ordered a USB RT5370. When it gets here I'll test to see if I can get past 7 clients with it. This may be my fix if the on board wifi cannot handle more than 7.

@ghost
Copy link

@ghost ghost commented Jan 4, 2021

I just conducted tests today with a rpi 3b+ and a rpi 4 with the latest image of Raspberry Pi OS Lite and a RT5370 USB dongle and in both cases I managed to connect 30 devices (mix of iPads and Android tablets) without any problem.

@rafaelpascale
Copy link

@rafaelpascale rafaelpascale commented Jan 28, 2021

I tested with 7 clients (ESP32) on raspberry 4 and not worked, always lost one device
With raspberry 3b+ worked with 20 clients

Will be the beaglebone black work better than raspbery 4 for MQTT connections ?

@freakbsd
Copy link

@freakbsd freakbsd commented Mar 1, 2021

Same problem here, 8 clients connected, no more.
RPI4 (4g ram), Buster updated.

In the end, @pelwell is right here #3010 (comment), so if you're just looking to increase the number of connected clients, then take a look at this table iiab/iiab#823.

Take 7.45.18.0 (follow the link) and replace /var/lib/firmware/brcmfmac43455-sdio.bin (of course, make a backup first). Reboot.

I've done it 2 days ago and until now I see no issues, stability seems okay, 20 clients connected.

@freakbsd
Copy link

@freakbsd freakbsd commented Mar 8, 2021

Still stable, 23 clients connected.

@Choupinounours
Copy link

@Choupinounours Choupinounours commented Mar 16, 2021

Same problem here, 8 clients connected, no more.
RPI4 (4g ram), Buster updated.

In the end, @pelwell is right here #3010 (comment), so if you're just looking to increase the number of connected clients, then take a look at this table iiab/iiab#823.

Take 7.45.18.0 (follow the link) and replace /var/lib/firmware/brcmfmac43455-sdio.bin (of course, make a backup first). Reboot.

I've done it 2 days ago and until now I see no issues, stability seems okay, 20 clients connected.

I also tried today and it worked with 20 clients ! Thanks a lot !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet