thorrak / fermentrack

A replacement web interface for BrewPi
MIT License
137 stars 61 forks source link

Error when debugging connection #263

Open jangevaare opened 6 years ago

jangevaare commented 6 years ago

I am encountering this when I go to debug an ESP8266 which is currently failing to connect (which is on v0.10 firmware, so somewhat unexpected in of itself, will investigate further). Cheers.

Traceback:

Environment:

Request Method: GET
Request URL: http://10.0.1.62/devices/6/debug_connection/

Django Version: 1.11.11
Python Version: 3.5.3
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'app.apps.AppConfig',
 'firmware_flash.apps.AppConfig',
 'gravity.apps.GravityAppConfig',
 'constance',
 'constance.backends.database',
 'huey.contrib.djhuey']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback:

File "/home/fermentrack/venv/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/home/fermentrack/venv/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/home/fermentrack/venv/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/fermentrack/venv/lib/python3.5/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  23.                 return view_func(request, *args, **kwargs)

File "/home/fermentrack/fermentrack/app/decorators.py" in _wrapped_view
  27.                 return view_func(request, *args, **kwargs)

File "/home/fermentrack/fermentrack/app/views.py" in debug_connection
  831.             connection_check, version_check, version_string = connection_debug.test_telnet(hostname)

File "/home/fermentrack/fermentrack/app/connection_debug.py" in test_telnet
  29.     tn = telnetlib.Telnet(host=hostname, timeout=3)

File "/usr/lib/python3.5/telnetlib.py" in __init__
  218.             self.open(host, port, timeout)

File "/usr/lib/python3.5/telnetlib.py" in open
  234.         self.sock = socket.create_connection((host, port), timeout)

File "/usr/lib/python3.5/socket.py" in create_connection
  712.         raise err

File "/usr/lib/python3.5/socket.py" in create_connection
  703.             sock.connect(sa)

Exception Type: OSError at /devices/6/debug_connection/
Exception Value: [Errno 113] No route to host
jangevaare commented 6 years ago

FYI: I did a restart of the access point, waited a few minutes and ESP didn't reconnect. Then did a hard reset of the ESP8266, and it started talking to fermentrack again.

jangevaare commented 6 years ago

This has been happening again lately - have done restarts of both my esp8266 controller and the fermentrack server to no avail. The LCD on the controller indicates it is still doing what it's supposed to. I include the most recent traceback below.

I went to the admin settings and changed the last cached ip address to what the controller LCD showed during it's most recent boot (they were different), and that fixed everything. So perhaps there is a more graceful way to handle unexpectedly changed IP addresses of controllers here. For the future I'll just set some DHCP reservations for my controllers. May be good to have a recommendation for static IPs somewhere if it doesn't already exist.


Request Method: GET
Request URL: http://10.0.1.64/devices/2/debug_connection/

Django Version: 1.11.13
Python Version: 3.5.3
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'app.apps.AppConfig',
 'firmware_flash.apps.AppConfig',
 'gravity.apps.GravityAppConfig',
 'constance',
 'constance.backends.database',
 'huey.contrib.djhuey',
 'raven.contrib.django.raven_compat']
Installed Middleware:
['raven.contrib.django.middleware.DjangoRestFrameworkCompatMiddleware',
 'raven.contrib.django.middleware.SentryMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback:

File "/home/fermentrack/venv/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/home/fermentrack/venv/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/home/fermentrack/venv/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/fermentrack/venv/lib/python3.5/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  23.                 return view_func(request, *args, **kwargs)

File "/home/fermentrack/fermentrack/app/decorators.py" in _wrapped_view
  27.                 return view_func(request, *args, **kwargs)

File "/home/fermentrack/fermentrack/app/views.py" in debug_connection
  900.             connection_check, version_check, version_string = connection_debug.test_telnet(hostname)

File "/home/fermentrack/fermentrack/app/connection_debug.py" in test_telnet
  29.     tn = telnetlib.Telnet(host=hostname, timeout=3)

File "/usr/lib/python3.5/telnetlib.py" in __init__
  218.             self.open(host, port, timeout)

File "/usr/lib/python3.5/telnetlib.py" in open
  234.         self.sock = socket.create_connection((host, port), timeout)

File "/usr/lib/python3.5/socket.py" in create_connection
  712.         raise err

File "/usr/lib/python3.5/socket.py" in create_connection
  703.             sock.connect(sa)

Exception Type: ConnectionRefusedError at /devices/2/debug_connection/
Exception Value: [Errno 111] Connection refused