WiFi disconnects in 20210503

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

WiFi disconnects in 20210503

#1 Post by mdax82 » 17 May 2021, 09:01

Running a few ESP8266 here with ESP_Easy_mega_20210114_normal_ESP8266_4M1M connected stable to WiFi without any issues.
Updated a few to ESP_Easy_mega_20210503_normal_ESP8266_4M1M and suddenly I see them random disconnect/ reconnect to WiFi.
They remain disconnected for a couple of minutes or hours. At some point they connect back to WiFi.

From setup point of view WiFi is setup as Mesh so SSID's (visible) overlap and the one with best connection to be used. With the most
recent WiFi enhancements in ESP_Easy it appears very often wrong decission is made connecting to the wrong AP (single SSID) with suboptimal connection.

"Last Disconnect Reason: (8) Assoc leave"

is seen then.

Tried to tune as much as possible in the WiFi settings in various combinations:
WiFi Settings
WiFi Settings
Force WiFi B/G: false
Restart WiFi Lost Conn: false
Force WiFi No Sleep: false
Periodical send Gratuitous ARP: false
Connection Failure Threshold: 0
Max WiFi TX Power: 17.50
Current WiFi TX Power: 14.00
WiFi Sensitivity Margin: 3
Send With Max TX Power: false
Extra WiFi scan loops: 2
Periodical Scan WiFi: true

Though I can never reach the same stability level as it was in 20210114. I had seen similar issue already in 20210223 but decided to skip this release at that time.

It somehow sounds a bit like "ESP82xx_mega-20210503 WiFi problem" viewtopic.php?f=6&t=8528 and tried linked ESP_Easy_mega_20210505_custom_ESP8266_4M1M
which seem to improve things as reconnects seem to happen more frequently but overall the issue remains.

I can exclude a device failure as it impacts multiple ones. 2 ESPs sitting next to each other: 20210114 (works stable) and 20210503/20210505 (reconnects randomly)

Any hint how to fix this issue? Is there any WiFi setting combination which would match 1:1 the 20210114 build behaviors?

Many thanks!

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WiFi disconnects in 20210503

#2 Post by TD-er » 17 May 2021, 09:06

Maybe disable periodical wifi scan?

mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

Re: WiFi disconnects in 20210503

#3 Post by mdax82 » 17 May 2021, 09:10

Tried this already in one of the many combinations it did not really had any impact. I can give it a try again though...

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WiFi disconnects in 20210503

#4 Post by TD-er » 17 May 2021, 09:27

Maybe also test with:
Send With Max TX Power: checked

mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

Re: WiFi disconnects in 20210503

#5 Post by mdax82 » 17 May 2021, 09:41

Max TX Power is indeed something with scared me off a bit to play with but testing now with the following set:

Code: Select all

WiFi Settings
Force WiFi B/G:	false
Restart WiFi Lost Conn:	false
Force WiFi No Sleep:	false
Periodical send Gratuitous ARP:	false
Connection Failure Threshold:	0
Max WiFi TX Power:	17.50
Current WiFi TX Power:	14.00
WiFi Sensitivity Margin:	3
Send With Max TX Power:	true
Extra WiFi scan loops:	2
Periodical Scan WiFi:	false
Thx :)

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WiFi disconnects in 20210503

#6 Post by TD-er » 17 May 2021, 09:59

See here for more detailed info on what the settings do:
https://espeasy.readthedocs.io/en/lates ... -threshold

Periodical send Gratuitous ARP is also one best to have enabled, although it should not make a difference with disconnects/reconnects, only with reachability of the ESP.

Force WiFi B/G will give you some extra range as the TX-power can be higher (max. 20.5, you still need to increase the setting if you wish to use it) and the RX sensitivity is also better.
Max TX power for 802.11n = 14 dBm, 802.11g = 17 dBm, 802.11b = 20.5 dBm.
But we're not using the 'b' mode, so you won't see any difference between 17.5 and 20.5 dBm as setting. (for now..., might change that later)

mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

Re: WiFi disconnects in 20210503

#7 Post by mdax82 » 18 May 2021, 14:12

Thx, the last change

Code: Select all

Send With Max TX Power:	true
seem to improve things immense testing it a bit further if it remains stable.

Was this the same behavior in 20210114?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WiFi disconnects in 20210503

#8 Post by TD-er » 18 May 2021, 14:31

On older builds (not sure when I added the TX pwd option) the TX power was always set to max.
This could lead to some issues on some nodes, but as always it is not a fix for every scenario.

N.B. I just merged some temp fix for units not being able to reconnect to WiFi for a long time (or needing a power cycle).

Last night I had one of my own units (connected to serial log) showing the issue of not reconnecting.
So I could see what was wrong then. It appeared the WiFi events were not considered to timeout, so if not all events were processed (e.g. more likely to happen on static IP) it would wait forever (until it crashed....)
So I do have to take a closer look at it, as it is possible to get in the situation where a new connection cannot be started as there are unprocessed wifi events and those events cannot be processed as they are waiting for another event to happen first.
But for now it should (not so elegantly) get out of this infinite loop.

mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

Re: WiFi disconnects in 20210503

#9 Post by mdax82 » 19 May 2021, 08:29

It was running stable for about 15hrs but then startet to disconnect/ reconnect for about 2hrs never got a stable connection. Power cycled it and now its stable again.
No other devices had issues at that time...

testing now with
Periodical send Gratuitous ARP

if this changes anything.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WiFi disconnects in 20210503

#10 Post by TD-er » 19 May 2021, 09:08

Still on the latest 'nightly' build?
Or are you using the latest code base?

mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

Re: WiFi disconnects in 20210503

#11 Post by mdax82 » 19 May 2021, 10:19

Using the custom build linked from viewtopic.php?f=6&t=8528

Code: Select all

ESP Easy | Information |
 -----|-----|
Build:⋄|20113  - Mega|
System Libraries:⋄|ESP82xx Core 2843a5ac, NONOS SDK 2.2.2-dev(38a443e), LWIP: 2.1.2 PUYA support|
Git Build:⋄|Skrzypowa: May  5 2021 22:15:20|
Plugin Count:⋄|32 |
Build Time:⋄|May  5 2021 22:15:11|
Binary Filename:⋄|ESP_Easy_mega_20210505_custom_ESP8266_4M1M|
Build Platform:⋄|Windows-10-10.0.19041-SP0|
Git HEAD:⋄|'bugfix/std_move_controllerqueue_e519d0b'|
shall I go back to the last nightly 20210503?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WiFi disconnects in 20210503

#12 Post by TD-er » 19 May 2021, 11:14

I can also make one for you, based on the current code as that does contain a fix which hopefully fixes this issue.
What build do you need?

mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

Re: WiFi disconnects in 20210503

#13 Post by mdax82 » 19 May 2021, 11:37

That would be awesome, ESP_Easy_mega_20210503_normal_ESP8266_4M1M.bin in a more recent build needed then.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WiFi disconnects in 20210503

#14 Post by TD-er » 19 May 2021, 11:48

2 builds for you to test:

* normal 'mega' branch: https://www.dropbox.com/s/ipvhx546kxwm4 ... M.bin?dl=0
* normal build where I hopefully fixed some MQTT reconnect issues: https://www.dropbox.com/s/hiaasmlkcgt41 ... M.bin?dl=0 See related issue: https://github.com/letscontrolit/ESPEas ... -843910973

Would be great if you could test the one of the pending pull request first and if that one works, no need to test the other one.
I would like to hear from you which one you test and whether it is a fix for your issues.

N.B. as a tip on making the WiFi connection more stable, in tools->advanced you can enable the "send with max. TX power"
But for testing the wifi reconnect, I guess you should first try to make it disconnect.

Also, do you use static IP or via DHCP?

mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

Re: WiFi disconnects in 20210503

#15 Post by mdax82 » 19 May 2021, 15:03

Alright using the following now:

Code: Select all

ESP Easy | Information |
 -----|-----|
Build:⋄|20113  - Mega|
System Libraries:⋄|ESP82xx Core 2843a5ac, NONOS SDK 2.2.2-dev(38a443e), LWIP: 2.1.2 PUYA support|
Git Build:⋄|'bugfix/MQTT_check_connected_956c329'|
Plugin Count:⋄|47 [Normal]|
Build Time:⋄|May 19 2021 11:41:38|
Binary Filename:⋄|ESP_Easy_mega_20210519_normal_ESP8266_4M1M|
Build Platform:⋄|Windows-10-10.0.19041-SP0|
Git HEAD:⋄|'bugfix/MQTT_check_connected_956c329'|
Settings

Code: Select all

WiFi Settings
Force WiFi B/G:	false
Restart WiFi Lost Conn:	false
Force WiFi No Sleep:	false
Periodical send Gratuitous ARP:	false
Connection Failure Threshold:	0
Max WiFi TX Power:	17.00
Current WiFi TX Power:	14.00
WiFi Sensitivity Margin:	3
Send With Max TX Power:	false
Extra WiFi scan loops:	2
Periodical Scan WiFi:	false
Using DHCP address

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WiFi disconnects in 20210503

#16 Post by TD-er » 19 May 2021, 15:11

Enabling these will make your WiFi connection more stable, but harder to reproduce the WiFi reconnect issue:
- Send With Max TX Power
- Restart WiFi Lost Conn
- Periodical send Gratuitous ARP

mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

Re: WiFi disconnects in 20210503

#17 Post by mdax82 » 19 May 2021, 16:30

After about 90min it lost connection for about 12min and recovered then. Lets see if this happens more often.

Its a test device so no issues debug further is there any way I can collect more information?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WiFi disconnects in 20210503

#18 Post by TD-er » 19 May 2021, 18:03

Is this with "Restart WiFi Lost Conn" checked?
Periodical WiFi scan disabled?

mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

Re: WiFi disconnects in 20210503

#19 Post by mdax82 » 19 May 2021, 19:26

Is this with "Restart WiFi Lost Conn" checked? -> No
Periodical WiFi scan disabled? -> Yes

mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

Re: WiFi disconnects in 20210503

#20 Post by mdax82 » 21 May 2021, 09:16

After 1st reconnect as described it took about 6h it somehow struggled again with total connetion loss/ reconnect. Not stable for about 30min so I power cycled it.
After recovered I set "Send With Max TX Power" it stayed up for about 23h and struggled then for about 40min until it recovered on its own (still no Restart WiFi on Lost Conn set".
Another ~10h later struggled again for about 10min recovered on its own then.

I also set now "Periodical send Gratuitous ARP"

Code: Select all

Force WiFi B/G:	false
Restart WiFi Lost Conn:	false
Force WiFi No Sleep:	false
Periodical send Gratuitous ARP:	true
Connection Failure Threshold:	0
Max WiFi TX Power:	17.00
Current WiFi TX Power:	14.00
WiFi Sensitivity Margin:	3
Send With Max TX Power:	true
Extra WiFi scan loops:	2
Periodical Scan WiFi:	false
All other ESPs on 20210114 connected so same infrastructure had no issues at that times.

Interesting though
Last Disconnect Reason: (202) Auth fail
while previously it was
Last Disconnect Reason: (8) Assoc leave

Let see - next try might be switch on the WiFi Scan again?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WiFi disconnects in 20210503

#21 Post by TD-er » 21 May 2021, 09:36

I don't think the periodical wifi scan may be the fix here, as I do believe there is some bug in the check if it may be allowed to perform a WiFi scan.
The auth fail may also be some indication that there is some mixup in which set of credentials it thinks it is using and what may actually be used.

I think the february build may also work just fine, as I do have the feeling I messed up just a few weeks ago.

mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

Re: WiFi disconnects in 20210503

#22 Post by mdax82 » 23 May 2021, 09:26

So far it seems

Code: Select all

Send With Max TX Power:	true
Periodical send Gratuitous ARP:	true
turns out to be quite stable no issues since about 48hrs which marks a new high :)

Saw (202) Auth fail though again but seems its that fast not causing too much of an issue.

As mentioned I had skipped the february build can test this later if this turns out to be stable.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WiFi disconnects in 20210503

#23 Post by TD-er » 23 May 2021, 09:48

I may ask you later to try a newer build as there was for sure a bug in the code when WiFi events happened out of (expected) order.

mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

Re: WiFi disconnects in 20210503

#24 Post by mdax82 » 26 May 2021, 13:47

Seems I jinxed it shortly after my last post "48hrs" it disconnected.

Extended the setup a bit 3 ESPs next to each other

Prod (and most stable until now):

Code: Select all

ESP_Easy_mega_20210114_normal_ESP8266_4M1M
WiFi Settings
Force WiFi B/G:	false
Restart WiFi Lost Conn:	false
Force WiFi No Sleep:	false
Periodical send Gratuitous ARP:	false
Connection Failure Threshold:	0
Lab1:

Code: Select all

ESP_Easy_mega_20210223_normal_ESP8266_4M1M / 
WiFi Settings
Force WiFi B/G:	false
Restart WiFi Lost Conn:	false
Force WiFi No Sleep:	false
Periodical send Gratuitous ARP:	true
Connection Failure Threshold:	0
Max WiFi TX Power:	17.00
Current WiFi TX Power:	14.00
WiFi Sensitivity Margin:	3
Send With Max TX Power:	true
Lab2:

Code: Select all

ESP_Easy_mega_20210519_normal_ESP8266_4M1M (bugfix/MQTT_check_connected_956c329)
WiFi Settings
Force WiFi B/G:	false
Restart WiFi Lost Conn:	false
Force WiFi No Sleep:	false
Periodical send Gratuitous ARP:	true
Connection Failure Threshold:	0
Max WiFi TX Power:	17.00
Current WiFi TX Power:	14.00
WiFi Sensitivity Margin:	3
Send With Max TX Power:	true
Extra WiFi scan loops:	2
Periodical Scan WiFi:	false
The bug you mentioned kick in randomly or after longer period of time?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WiFi disconnects in 20210503

#25 Post by TD-er » 26 May 2021, 14:11

It depends... (as always :) )
The problem is related to reconnecting to WiFi and the order in which the WiFi events may occur.

So it depends mainly on the stability and reception quality of WiFi.

mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

Re: WiFi disconnects in 20210503

#26 Post by mdax82 » 26 May 2021, 14:28

Understood :) any new build I shall test let me know.

mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

Re: WiFi disconnects in 20210503

#27 Post by mdax82 » 04 Jun 2021, 11:55

So far it seems
ESP_Easy_mega_20210114_normal_ESP8266_4M1M
and
ESP_Easy_mega_20210223_normal_ESP8266_4M1M

seem to behave quite similar/ stable.

ESP_Easy_mega_20210519_normal_ESP8266_4M1M (bugfix/MQTT_check_connected_956c329)
seem to fail random after some time, reconnects most of time though it has a habbit doing this in a Mesh network
by choosing the wrong AP with worse RSSI ending up in packet loss/ further connection issues.

mdax82
Normal user
Posts: 17
Joined: 15 May 2021, 08:57

Re: WiFi disconnects in 20210503

#28 Post by mdax82 » 19 Aug 2021, 10:23

using ESP_Easy_mega_20210802 now and it seem to work very well so far. :D

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WiFi disconnects in 20210503

#29 Post by TD-er » 19 Aug 2021, 21:41

mdax82 wrote: 19 Aug 2021, 10:23 using ESP_Easy_mega_20210802 now and it seem to work very well so far. :D
Good to hear :)

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 34 guests