-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
WiFi disconnections (IDFGH-204) #1788
Comments
@rojer How often did it happen? Could you provide a demo to reproduce it? |
unfortunately, it only happens very infrequently and i cannot reproduce it at will. we have automated tests and sometimes one of them just fails with these messages in the log. |
@rojer Did you call esp_wifi_stop() in your code? |
@TimXia no, this disconnection was not intentional |
@rojer Could you provide a demo which can reproduce the issue? We can not reproduece it in our test. |
I'm having this issue as well, but for me it's very consistent. |
@PaladinEng What is the commit ID of IDF you use? How often did it happen? |
The commit ID is: bd26045 |
OK, the behavior is unrelated to This code is basically identical to the template and the simple wifi example, so it really should be working. |
@TimXia as i said, i cannot really reproduce it at will. it happens with the same code that works most of the time. my only hope was that the alloc error message will be enough for you to figure out what's going on. what i can say is that it's not heap memory shortage, there's plenty of heap available. @PaladinEng can you confirm that you see |
@rojer It's hard to debug with the alloc error message. What's the commit ID of your IDF? |
@TimXia yeah, i see that. sorry, i don't really have much to offer as additional help except that it happens sometimes, on different tests we run, on different devices, and i see these messages in the logs. we use a fork of IDF, currently based on 8478823 . there are a few patches on top of it but they are not related (the branch is here). |
@TimXia maybe you can add printing some additional debug info when this alloc failure happens? i would then post new logs when it happens. we usually stay pretty close to IDF master, so it shouldn't take that long. |
@rojer I cannot confirm that I see the @TimXia |
@rojer Sorry, we can not reproduce the issue. If you can provide a demo which can reproduce the issue, it will be much helpful. |
@PaladinEng Is the router that you try to connect to is far away from your device? Does it fail all the time if you continue to try to connect to the router again and again(at least 10 times)? |
@TimXia the wifi router is only 10 feet away from the device, and sufficiently strong that I'm able to get a useful signal with most devices more than 100 feet away, through a brick wall. I've just power-cycled my router and modem, erased the flash, and made a clean flash, and let the program run. It usually connects correctly the first time the program runs. I've tested this three times in a row, and successfully connected each time. I'm currently letting the program run to see how long it will stay connected. I will provide a log of the output. Typically, if I kill the program and re-flash, it will not connect without also power cycling the wifi router. Additionally, even with a successful connection, it eventually disconnects and never successfully reconnects. After I finish the current run, I'll run a long-duration (hour or more) test to capture that output as well. |
@TimXia So, I just let the program run for a few hours. It stayed connected, but no packets were exchanged. I immediately reflashed and re-ran the program. This time, rather surprisingly, it eventually reconnected. I've attached both the output log and the wireshark capture in the hopes there is something useful there. |
@TimXia any progress on this? Anything I can do to assist? |
I'm having the exact same problem, from what I can understand the device is running out of memory and allocation of a buffer is failing.. It seems that memory consumption in the latest 3.x idf release is substantially higher than earlier versions and may be responsible.. W (80194131) wifi: m f probe req l=0 I (80194251) wifi: n:1 1, o:1 0, ap:255 255, sta:1 1, prof:1 |
i should note as well that the firmware this happens on is "fatter" than other firmware we test (it includes JS engine). |
Still having the same problem but like you pointed out, the heap still has lots of memory and checking the max available block allocation size there should still be no reason for an allocation failure..
Notice how each time it's trying to connect to 'ESP_09C6F5'... Should be connecting to Com Com Services.. This is printed in the STA_DISCONNECTED event..
An additional note is that the ethernet interface quits working aswell at the same time, even if we set the IF_ETH interface as the default interface. If anyone has anything to add it would be very appreciated, @rojer, did you figure out anything? |
@comcomservices nope, still happens every now and then. |
It's absolutely killing us! We've spent the past week trying to get to the bottom of it with no luck.. Basically we're at the point where we automatically reboot our device every 40m but there's no way we can release a product until this is resolved. Let us know if any of you guys found out anything related to it and why some people are afflicted by it and not others.. |
@TimXia or anyone, got any idea what the issue is? Could it be a setting on the router? |
I had a similar problem and I resolved it without changing the promiscuous mode. If you put "false" in this mode you not able to capture the packets in the air and after (i don't know the number) few packets the esp32 in station mode disables the connection with the AP and crash (impossible to reboot); if you don't leave the promiscouse mode this will not happening. |
@GiulianoPortaro, would you mind elaborating a little bit more on what you did? How is it different from the ESP examples / documentation? esp_wifi_get_promiscuous(&proMode); returns false so it seems promiscuous mode is already disabled.. |
Well, I doing a project where sniffing packet in a specific channel and after 1 minute I block the promiscuous mode (esp_wifi_set_promiscuous(false);) to synchronize timer of the ESP32 (with a sntp cluster, protocol UDP) and to send the packets at one server (with socket library); after I do all, I enable the promiscuous mode (same command with true) to continue a sniffing packets. This is all correct but after 1 minutes or 40 minutes (the interval is not deterministic) i obtain the same issues discussed here. I read on the web, don't remember where, that the ESP32 in station mode close the connection with the AP if don't receive probe packet after one time (that is configurable, in ms with a maximum threshold, in the wifi_config_t struct) close the connection but after this event it is impossible to reconnect or reboot (i tried to insert a esp_reboot, or esp_wifi_stop, command in the handler event function but don't have effect, rather it has caused other problem). The only soluction that I found, after many test, is: not disable never the promiscuous mode. I think, but i not sure, that this problem maybe resolved, also, if reconfigure the wifi struct in AP+STA before handle other task. |
@rojer @comcomservices Could you provide a demo that can reproduce this issue? We can not reproduce it with our test code. Or could you descript the detail of your project, e.g. the WiFi mode do you use, promiscuous mode enabled or not, the more the better. It's better to provide a demo, it will help us to solve the problem. |
@PaladinEng Your problem is different from others. Please erase the flash before downloading bin files to the device, and then use the latest IDF code to test. |
Me too facing wifi disconnect issue now and then and had posted complete log in |
Hi @GiulianoPortaro my project is very similar to yours and I've the same issues. Have you resolved the disconnection problem after disable promiscuous mode? I tried almost everything but nothing seems to work and the only solution seems to maintain the promiscuous mode active for all the time. |
@fisherman6v6 The ESP32 has a factory defect, or a design choice depends on the point of view, which prevents you from activating the station mode (including wifi connect) + the promiscuous mode and then deactivating the promiscuous mode. In fact if you do this the device will stop working. If you are trying to capture packets for a period of time DO NOT DEACTIVATE the promiscuous mode but enter the code you want to perform in that time frame in a higher priority handler: in this way the ESP32 will not disable the WiFi connection and will not block ; moreover, there is a similar problem in pairing bluetooth with Wifi For example:
|
@fisherman6v6 @GiulianoPortaro Yes, it's better not to call |
Hello, Any solution in this issue? I am having the same problem. I'm running the BLE and Wifi at the same time, after ~15min I get the following problem:
After this, the ESP32 reboots. |
I am getting similar error I am using WIFI with external RAM. Internal Heap free: 41120 Plenty of external ram and some internal RAM. Does in default settings WIFI only uses internal ram. |
Hi, I would like to report my issue on WiFi disconnection and "wifi" task got stuck `I (3518155) wifi: bcn_timout,ap_probe_send_start I (3520664) wifi: n:7 0, o:7 2, ap:255 255, sta:7 2, prof:1
Before getting the "bcn_timout,ap_probe_send_start" the available heap was around 47200bytes.
`git submodule 00e64bfb47a596c6d375ab7b89ec2733c66da2be components/bt/lib (remotes/origin/release/v3.1) 6468887a12666f88b8704d797fc176cd4f40ee4c components/coap/libcoap (v4.1.1-401-g6468887) 1373c2075a9524437cbb4bdfd8576dedb77c68a2 components/esp32/lib (remotes/origin/release/v3.1-25-g1373c20) fd8c25d2160505fb9d5abbe56f85116a136afb05 components/esptool_py/esptool (v2.4.1-5-gfd8c25d) 7cc52f60356909b3dd260304c7c50c0693699353 components/json/cJSON (v1.7.1) 70170c28c844a4786e75efc626e1aeebc93caebc components/libsodium/libsodium (1.0.12) b9ada3067587aaccb37c33d41733bb82496c6342 components/mbedtls/mbedtls (mbedtls-2.9.0-641-gb9ada306) d037ec89546fad14b5c4d5456c2e23a71e554966 components/micro-ecc/micro-ecc (v1.0) 3bcc416e13cc790e2fb45fcfe9111d38609c5032 components/nghttp/nghttp2 (v1.24.0) f5e26c4e933189593a71c6b82cda381a7b21e41c components/spiffs/spiffs (0.2-221-gf5e26c4)` I have also noticed that this could happen also when "esp_wifi_stop" API is called. |
now I keep internal ram usage under control. WIFI needs at least 50k internal ram free available. seems to me good so far. |
Hello @snahmad,
Where did you get this limit? From docs or from tests. I also noticed that RAM usage is critical..but esp32 itself is quite "limited" (respect to others modules) in RAM size. Thanks |
I have started to get this issue as well :-( Started after i updated esp-idf. |
@rojer Thanks for reporting the issue. Feel free to reopen if the issue still exists. Thanks. |
99.9% Try changing your router. I have spent few days debugging. Then I had to move to another place and... I was surprised! Everything works just perfect! Similar behavior exists with both wolfssl from mbedTLS. It is definitely some sort of bug, but where? Usually my app leaves around 160000 bytes of free heap, but after loading webpage thru my home router it has only 1208 bytes. |
I was having the same issue, using the latest SDK (v4.4-dev-2977-gdd491ee851-dirty) and implementation of |
@hassandraga Is it correct, that ENABLING "promiscuous mode" will forward more packages for processing, right? Is that feature enabled as default, since it makes a difference for you, when DISABLING it? Do not understand me wrong. I am just curious. And trying to figure out instability in SDKV4 (4.3.1) related to Wi-Fi connectivity. |
Hi @hassandraga @MartinTJDK |
Sometimes we get wifi disconnects in our tests, after which it is unable to reconnect:
first connection is successful:
but after a few seconds it disconnects and never recovers:
The text was updated successfully, but these errors were encountered: