nerves-project-attic/nerves_network

Loss of WiFi association does not clear interface

Closed this issue · 5 comments

To reproduce, associate with an access point and make sure that you have a good connection and IP works, etc. Then turn off the power to the access point.

The log messages will report that the event :wifi_disconnected was sent, but if you run cmd("ip address"), you'll see that there's still an IP address attached to the wlan0 interface. This should have been cleaned up.

Hi,

I wonder if this is associated with an issue I've been seeing. We have a few Pi Zero Ws in the office, streaming data to a server. Intermittently one will disappear from the network. It was hard to reproduce the issue as it can take days, or sometimes weeks, for it to happen and it wasn't initially clear that it was just a network problem. The WiFi is out of our control, and can be a bit flaky sometimes.

Here's the behaviour I've eventually managed to see:

  • Network connection is lost due to whatever reason (eg walking some distance from the access point).
  • Sometimes the connection is reestablished (eg after returning to the office); occasionally it isn't.
  • :inet.getifaddrs/0 still shows an IP associated with wlan0 even when the connection is not been reestablished.
  • Killing Nerves Network reestablishes the connection.

Yeah that is a separate but related bug. Occasionally system_registry (which backs the network configuration) crashes which causes the configuration to be lost, and the only way to bring it back is to do whatever originally called setup again. I've hit this a lot and haven't really put work into a solution yet.

👍

(I've implemented a workaround, which kills the networking if the server can't be reached too often. That seems to be holding so far.)

I unfortunately have to do something similar in most of my Networked Nerves applications.

Fixed in #97