Skip to content
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

PI's DNS got wedged after physical power failure / restore. #160

Open
anschweitzer opened this issue Jan 26, 2023 · 5 comments
Open

PI's DNS got wedged after physical power failure / restore. #160

anschweitzer opened this issue Jan 26, 2023 · 5 comments

Comments

@anschweitzer
Copy link
Collaborator

My pi’s dns got wedged after power loss / restore in Cambridge. Restart PI fixed it. I didn’t try restarting the router. Ideally we can figure out something less drastic, but if we can’t restore comm long enough, we should probably reboot the pi.

@anschweitzer
Copy link
Collaborator Author

I think this is same issue as #155, though that one documents some other issues.

@anschweitzer
Copy link
Collaborator Author

An approach:

  1. We can detect DNS not working by the specific network error, and/or we can issue a ping to some well known server. As a backstop we detect by no mqtt broker connection after a long time.
  2. Do some research into what service needed to be restarted and try to just restart that service.
  3. If all else fails after a long time, reboot the pi.

@anschweitzer
Copy link
Collaborator Author

anschweitzer commented Feb 17, 2023

Probably same issue happened in Freedom on apple: log.zip

One of the errors:

 /home/pi/gw-scada-spaceheat-python/gw_spaceheat/proactor/mqtt.py, line 89, in _client_thread
                   

 self._client.connect(self._client_config.host, port=self._client_config.port)
    File                              
 /home/pi/.local/lib/python3.10/site-packages/paho/mqtt/client.py, line 914, in connect
      return             
 self.reconnect()
    File /home/pi/.local/lib/python3.10/site-packages/paho/mqtt/client.py, line 1044, in       
 reconnect
      sock = self._create_socket_connection()
    File                                                   
 /home/pi/.local/lib/python3.10/site-packages/paho/mqtt/client.py, line 3685, in _create_socket_connection
      
 return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
    File                
 /usr/local/lib/python3.10/socket.py, line 824, in create_connection
      for res in getaddrinfo(host, port, 0, 
 SOCK_STREAM):
    File /usr/local/lib/python3.10/socket.py, line 955, in getaddrinfo
      for res in          
 _socket.getaddrinfo(host, port, family, type, proto, flags):
  socket.gaierror: [Errno -3] Temporary failure in     
 name resolution

@anschweitzer
Copy link
Collaborator Author

We might be able to reproduce this simply by disconnecting ethernet for an hour.

Various flavors of this did not succeed in getting dns to work.

@anschweitzer
Copy link
Collaborator Author

Another work around is to record the IP on each successful DNS connection and use that if DNS appears to fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant