Wifi Disconnect Loop

f.h-f.s.
Posts: 215
Joined: Thu Dec 08, 2016 2:53 pm

Wifi Disconnect Loop

Postby f.h-f.s. » Tue Jun 20, 2017 9:48 am

Lately after a few hours of running my esp32 goes into a disconnect loop.
I used to crash on:

Code: Select all

I (22425788) wifi: ap_probe_send over, resett wifi status to disassoc
See https://pastebin.com/bvW9P5R4

Ever since esp-idf 058eb26, my system is going into a wifi disconnect loop instead of a crash.
See https://pastebin.com/Atv4n3Qn

I have tested esp_wifi_disconnect() which properly disconnects
See https://pastebin.com/xCGM9gkq
Except on those wifi: ap_probe_send over, resett wifi status to disassoc

This problem occurs on a DOIT esp32, LoPy, SiPy. I also tested on 4 different routers.

What can I do about this problem? I would like to recover from this disconnect. A crash is less problematic because after a restart the esp32 functions again.

Edit Another disconnect loop on both a DOIT and LoPy https://pastebin.com/BQS8kCRT where wifi log level is set to verbose.(Updated esp-idf yesterday)
A github issue has been made under the name of the company https://github.com/espressif/esp-idf/issues/724

f.h-f.s.
Posts: 215
Joined: Thu Dec 08, 2016 2:53 pm

Re: Wifi Disconnect Loop

Postby f.h-f.s. » Fri Jun 23, 2017 9:17 am

We added a wifi deinit to try and circumvent the disconnect loop.

Code: Select all

static void reinit_wifi(void *param)
{
	ESP_LOGD(TAG, "Stop, Deinit Wifi");
	ESP_ERROR_CHECK(esp_wifi_stop());
	ESP_ERROR_CHECK(esp_wifi_deinit());

	ESP_LOGD(TAG, "Init, Start Wifi");
	ESP_ERROR_CHECK(esp_wifi_init(&cfg));
	ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_FLASH));
	ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
	ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
	ESP_ERROR_CHECK(esp_wifi_start());

	esp_wifi_set_ps(WIFI_PS_NONE); // Disable powersave

	ESP_LOGD(TAG, "Restart Wifi Done");
	vTaskDelete(NULL);
}
This function is started as a task, after 10 consecutive disconnects.
We tested this function by restarting the router. This caused 10 consecutive disconnects and then the ESP32 reconnected to the router and the internet. See log: https://pastebin.com/hXNHGPj3

This build ran from 21-6-2017 17:30 till 23-6-2017 on a DOIT and a LoPy
The disconnect loop occurred three times on both devices.
LoPy: https://pastebin.com/DKv9mxZX
DOIT: https://pastebin.com/0GTry5km
The disconnect loops and subsequent crashes occurred on 6 different times. These are the last time marks in the log files before the crash:

Code: Select all

DOIT
I (14567551) Statistics: [21-06-17 20:06:56Z] Uptime: 000.04:02:38	IPv4: 10.0.2.251	Free Heap: 17140	Temperature: 75
I (9736161) Statistics: [22-06-17 16:21:57Z] Uptime: 000.02:42:07	IPv4: 10.0.2.251	Free Heap: 75276	Temperature: 76
I (7312241) Statistics: [22-06-17 18:25:33Z] Uptime: 000.02:01:43	IPv4: 10.0.2.251	Free Heap: 75948	Temperature: 75

Code: Select all

LoPy
I (23643342) Statistics: [21-06-17 22:09:54Z] Uptime: 000.06:33:54	IPv4: 10.0.2.250	Free Heap: 55524	Temperature: 41
I (4682685) Statistics: [22-06-17 01:18:33Z] Uptime: 000.01:17:53	IPv4: 10.0.2.250	Free Heap: 62288	Temperature: 41
I (12137265) Statistics: [22-06-17 23:27:11Z] Uptime: 000.03:22:07	IPv4: 10.0.2.250	Free Heap: 75264	Temperature: 41
It seems I (81906) wifi: ap_probe_send over, resett wifi status to disassoc also occurs when resetting the router.

f.h-f.s.
Posts: 215
Joined: Thu Dec 08, 2016 2:53 pm

Re: Wifi Disconnect Loop

Postby f.h-f.s. » Mon Jun 26, 2017 11:02 am

We enabled CONFIG_SW_COEXIST_ENABLE, this does not have a effect on the occurrence of the disconnect loop.
Our system ran this weekend on the DOIT and LoPy. 9 Disconnect loops occurred

Code: Select all

DOIT
I (2339213) Statistics: [24-06-17 17:56:45Z] Uptime: 000.00:38:50	IPv4: 0.0.0.0	Free Heap: 139816	Temperature: 74
I (32786244) Statistics: [25-06-17 03:04:19Z] Uptime: 000.09:06:17	IPv4: 10.0.2.253	Free Heap: 74476	Temperature: 74
I (10469024) Statistics: [25-06-17 06:00:27Z] Uptime: 000.02:53:36	IPv4: 10.0.2.253	Free Heap: 38792	Temperature: 73
I (69754) Statistics: [25-06-17 06:08:20Z] Uptime: 000.00:01:00	IPv4: 10.0.2.253	Free Heap: 78924	Temperature: 74

LoPy
I (38835507) Statistics: [25-06-17 10:28:41Z] Uptime: 000.10:47:07	IPv4: 10.0.2.251	Free Heap: 66060	Temperature: 41
I (11640467) Statistics: [25-06-17 14:45:12Z] Uptime: 000.03:13:51	IPv4: 10.0.2.251	Free Heap: 34316	Temperature: 40
I (674877) Statistics: [25-06-17 14:58:18Z] Uptime: 000.00:11:05	IPv4: 10.0.2.251	Free Heap: 79044	Temperature: 40
I (1662877) Statistics: [25-06-17 20:40:20Z] Uptime: 000.00:27:34	IPv4: 10.0.2.251	Free Heap: 78648	Temperature: 41
I (8036827) Statistics: [25-06-17 23:17:55Z] Uptime: 000.02:13:47	IPv4: 10.0.2.251	Free Heap: 78080	Temperature: 41
In all 9 disconnect loops the WDT triggers ( The Task watchdog is set to 60seconds)
https://pastebin.com/bjTKxmKi

These lines from reinit_wifi are never reached:

Code: Select all

	ESP_LOGD(TAG, "Restart Wifi Done");
	vTaskDelete(NULL);

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: Wifi Disconnect Loop

Postby ESP_Sprite » Mon Jun 26, 2017 1:34 pm

FWIW, we're aware of this bug and we're trying hard to get this fixed before the 2.1 release.

f.h-f.s.
Posts: 215
Joined: Thu Dec 08, 2016 2:53 pm

Re: Wifi Disconnect Loop

Postby f.h-f.s. » Mon Jun 26, 2017 3:12 pm

Thank you! We didn't even know if we were doing something wrong. Glad to hear you guys are working on it =)

ricksondpenha
Posts: 7
Joined: Mon Sep 19, 2016 11:11 am

Re: Wifi Disconnect Loop

Postby ricksondpenha » Wed Nov 29, 2017 3:58 pm

ESP_Sprite wrote:FWIW, we're aware of this bug and we're trying hard to get this fixed before the 2.1 release.
Hi this bug still isn't fixed, I have a AWS IOT PUB SUB and a Multi client TCP server, whenever i send messages to either TCP server or via AWS IOT, after some time the wifi gives a beacon timeout error and refuses to reconnect again with the AP, i have tried to disconnect and reconnect, also de-initialising and initialising wifi again (where it crashes).. without any luck. Only way is to restart the esp32 whenever i detect beacon timeout (ERROR 200), but this is going to impact the transmissions and is a critical bug right now in my project. Is there any workaround for this?

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: Wifi Disconnect Loop

Postby ESP_Sprite » Thu Nov 30, 2017 9:15 am

You're posting in a topic half a year old... are you sure this is the same bug? What ESP-IDF version are you using?

Who is online

Users browsing this forum: No registered users and 82 guests