espeasy device locks up once in a while

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
GravityRZ
Normal user
Posts: 206
Joined: 23 Dec 2019, 21:24

espeasy device locks up once in a while

#1 Post by GravityRZ » 12 Apr 2021, 19:38

i currently have 3 active ESP modules, each with a fixed ip address and default gateway configured as 192.168.1.1 (router)

everything works withoutr problems but once in a while at a certain moment i can not access them through the assigned ip address.

it looks like the device is unavailable(browser hangs)
at that moment that is the same for every other esp module, none of them can be reached.

when i check wifi at that time i can use all other wifi devices like notebook, phone etc
so basically there is nothing wrong with the wifi or network


i suspect that UDP port 65500 creates the problem
this is the only thing linking those 3 together.

does anybody have had the same experience.

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: espeasy device locks up once in a while

#2 Post by Ath » 12 Apr 2021, 19:52

I have ca. 10 ESP's in a similar configuration, also on port 65500, but I can't confirm your findings. As the esp-network uses UDP for transporting messages, it is a 'fire and forget' type of network, so quite unlikely that would make them appear to 'hang'.

- do you have (serial) logs from the devices while they are inaccesible via Wi-fi?
- what is the RSSI value of the devices?
- are all devices on the same ESPEasy version?
/Ton (PayPal.me)

GravityRZ
Normal user
Posts: 206
Joined: 23 Dec 2019, 21:24

Re: espeasy device locks up once in a while

#3 Post by GravityRZ » 12 Apr 2021, 20:10

i do not have serial logs of the devices

de rssi levels are
-35 build 20112 20210411
-65 build 20111 20210114
-71 build 20112 20210223

if bad rssi levels will criple the complete 65500 global network then it might be saver to disable it

all have wifi nosleep

since the rest of the network does not have problems (they use the same gateway and dns) it must be something which relates to the esp's setup

is it wise to use 192.168.1.1 as gateway and dns or should i use 8.8.8.8 for dns

i gues that sending everything to 192.168.1.1 makes sure the router does the resolving

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

Re: espeasy device locks up once in a while

#4 Post by TD-er » 12 Apr 2021, 21:08

Just a short (hopefully not too short) introduction on how "Layer 2" networking works.

Each network device has a MAC address, which is supposed to be unique for every network device ever sold.
Communication between network devices is done based on these MAC addresses. This level of communication we call "layer 2" in the network stack.

A modern network (with switches and access points etc) does not broadcast every packet to every network device, but switches (and APs) do keep track of what MAC address is reachable via what fysical port (on the switch).

So how do we communicate based on IP addresses? IP addressing is not at "layer 2", but at "layer 3".
For every packet you wish to send to another network device and address based on IP address, you need to find out what MAC address has what IP address.

To get this information, a network host does send an ARP packet, which is essentially a question like "Who has 192.168.1.1?"
These ARP packets will be broadcasted over your network in the hope someone will answer "AA:BB:CC:DD:EE:FF has 192.168.1.1"
Since this response is also broadcasted, every switch (and Access Point) does know what port received this answer and thus can update its MAC tables stating what port can be used to reach the host with that MAC address.

The MAC tables of switches are of limited size and also this information can become outdated, so these tables will be cleared every now and then. (interval and protocol for deletion may differ among brands and models)
So it is possible a hop somewhere may no longer know how to route these packets as the MAC address is no longer (or has never been) in its MAC tables.
To fix this, a host may send out a new ARP packet and all is working again.

Now the problem with the ESP devices.
This ARP stuff will only work if ARP requests are being answered.
However the ESP nodes are known to not reply to these ARP requests.
To fight this symptom, I have added a feature in Tools->Advanced (bottom of the page) to send out Gratuituous ARP packets, or in other words answering questions nobody asked.
The ESP will broadcast at a regular interval "AA:BB:CC:DD:EE:FF has 192.168.1.1" and all switches and access points will take note of it by updating their MAC tables.

Apart from not receiving ARP requests every now and then, the ESP may also miss answers to DHCP requests and thus at some point no longer have an IP address.

What does happen in the WiFi part of the ESP is that the core libraries tend to lower power consumption of the ESP by reducing TX power and also increasing the DTIM interval (number of beacon intervals send by the access points to notify a connected client it has new packets waiting) without notifying the access point.
So the AP does not see a reply in due time on a beacon and thus throws away the packet.

What can be done against this?
- Turn off all sleep and eco mode thingies in the ESP settings.
- Send out ping requests continuously from another node to the ESP
- If the AP allows for it increase the timeouts (e.g. MikroTik devices have a "distance" setting which can be set to "outdoor")
- On newer builds, you can increase the WiFi sensitivity Margin
- Switch to "802.11g" mode
- Set the WiFi channel in the access point to a fixed channel

GravityRZ
Normal user
Posts: 206
Joined: 23 Dec 2019, 21:24

Re: espeasy device locks up once in a while

#5 Post by GravityRZ » 12 Apr 2021, 21:54

thanks TD-er for the comprehensive expanation


Turn off all sleep and eco mode thingies in the ESP settings:
DID THAT

- Send out ping requests continuously from another node to the ESP:
Doing this from node red, every minute ping, every 5 minutes ARP, every 60 minutes nmapscan

- If the AP allows for it increase the timeouts (e.g. MikroTik devices have a "distance" setting which can be set to "outdoor")
will try this

- On newer builds, you can increase the WiFi sensitivity Margin
will try this

- Switch to "802.11g" mode
will try this

- Set the WiFi channel in the access point to a fixed channel
allready fixed to channel 11


do i also need to enable Periodical send Gratuitous ARP also?

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

Re: espeasy device locks up once in a while

#6 Post by TD-er » 12 Apr 2021, 23:34

Send Gratuituous ARP is indeed a bit helpful in preventing the ARP issues.
But like I said, missing ARP requests is not the only problem here.

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests