apollo-ng / picoReflow

Turns a Raspberry Pi into a universal, web enabled Reflow Oven Controller
202 stars 118 forks source link

Status Websocket not available #4

Closed 3eggert closed 10 years ago

3eggert commented 10 years ago

When I open the website in a browser I get:

ERROR 1: Status Websocket not available

in the Browser and on the console: root@egpi:~/picoReflow# ./picoreflowd.py 2014-10-31 17:13:16,241 INFO picoreflowd: Starting picoreflowd 2014-10-31 17:13:16,294 INFO picoreflowd: listening on 0.0.0.0:8080 192.168.1.43 - - [2014-10-31 17:13:19] "GET /picoreflow/index.html HTTP/1.1" 200 8025 0.102052 192.168.1.43 - - [2014-10-31 17:13:19] "GET /picoreflow/assets/js/jquery.event.drag-2.2.js HTTP/1.1" 200 12989 0.022811 192.168.1.43 - - [2014-10-31 17:13:19] "GET /picoreflow/assets/js/jquery.flot.resize.js HTTP/1.1" 200 3297 0.020197 192.168.1.43 - - [2014-10-31 17:13:19] "GET /picoreflow/assets/js/jquery.flot.draggable.js HTTP/1.1" 200 5439 0.010698 192.168.1.43 - - [2014-10-31 17:13:19] "GET /picoreflow/assets/js/jquery.bootstrap-growl.min.js HTTP/1.1" 200 1304 0.009663 192.168.1.43 - - [2014-10-31 17:13:20] "GET /picoreflow/assets/js/bootstrap.min.js HTTP/1.1" 200 27911 0.069067 192.168.1.43 - - [2014-10-31 17:13:20] "GET /picoreflow/assets/css/bootstrap-modal.css HTTP/1.1" 200 4893 0.011440 192.168.1.43 - - [2014-10-31 17:13:20] "GET /picoreflow/assets/css/picoreflow.css HTTP/1.1" 200 13976 0.011733 192.168.1.43 - - [2014-10-31 17:13:20] "GET /picoreflow/assets/js/picoreflow.js HTTP/1.1" 200 16916 0.148512 192.168.1.43 - - [2014-10-31 17:13:20] "GET /picoreflow/assets/js/select2.min.js HTTP/1.1" 200 60906 0.193286 192.168.1.43 - - [2014-10-31 17:13:20] "GET /picoreflow/assets/js/jquery-1.10.2.min.js HTTP/1.1" 200 93270 0.428988 192.168.1.43 - - [2014-10-31 17:13:20] "GET /picoreflow/assets/css/bootstrap-theme.min.css HTTP/1.1" 200 17855 0.172529 192.168.1.43 - - [2014-10-31 17:13:20] "GET /picoreflow/assets/css/select2.css HTTP/1.1" 200 21128 0.146285 192.168.1.43 - - [2014-10-31 17:13:20] "GET /picoreflow/assets/js/jquery.flot.js HTTP/1.1" 200 121876 0.512764 192.168.1.43 - - [2014-10-31 17:13:20] "GET /picoreflow/assets/css/bootstrap.min.css HTTP/1.1" 200 103047 0.363543 192.168.1.43 - - [2014-10-31 17:13:20] "GET /picoreflow/assets/images/panel_bg.png HTTP/1.1" 200 678 0.015136 192.168.1.43 - - [2014-10-31 17:13:20] "GET /picoreflow/assets/css/select2.png HTTP/1.1" 200 761 0.009735 Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 508, in handle_one_response self.run_application() File "/usr/local/lib/python2.7/dist-packages/geventwebsocket/handler.py", line 63, in run_application self.run_websocket() File "/usr/local/lib/python2.7/dist-packages/geventwebsocket/handler.py", line 46, in run_websocket del self.server.clients[self.client_address] AttributeError: 'WSGIServer' object has no attribute 'clients' {'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTPACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,/_;q=0.8', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'en,de;q=0.7,en-us;q=0.3', 'HTTP_CACHE_CONTROL': 'no-cache', 'HTTP_CONNECTION': 'keep-alive, Upgrade', 'HTTP_DNT': '1', 'HTTP_HOST': '192.168.1.7:8080', 'HTTP_ORIGIN': 'http://192.168.1.7:8080', 'HTTP_PRAGMA': 'no-cache', 'HTTP_SEC_WEBSOCKET_KEY': 'vNjEqJT5+5kYs9mg8abCxA==', 'HTTP_SEC_WEBSOCKET_VERSION': '13', 'HTTP_UPGRADE': 'websocket', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:33.0) Gecko/20100101 Firefox/33.0', 'PATH_INFO': '/status', 'QUERY_STRING': '', 'REMOTE_ADDR': '192.168.1.43', 'REMOTE_PORT': '50751', 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': '', 'SERVER_NAME': 'egpi', 'SERVER_PORT': '8080', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'gevent/1.0 Python/2.7', 'wsgi.errors': <open file '', mode 'w' at 0xb6cad0d0>, 'wsgi.input': <gevent.pywsgi.Input object at 0xb4c72dd0>, 'wsgi.multiprocess': False, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0), 'wsgi.websocket': <geventwebsocket.websocket.WebSocket object at 0xb4c6d960>, 'wsgi.websocket_version': '13'} failed with AttributeError

192.168.1.43 - - [2014-10-31 17:13:20] "GET /status HTTP/1.1" 101 129 0.064676 Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 508, in handle_one_response self.run_application() File "/usr/local/lib/python2.7/dist-packages/geventwebsocket/handler.py", line 63, in run_application self.run_websocket() File "/usr/local/lib/python2.7/dist-packages/geventwebsocket/handler.py", line 46, in run_websocket del self.server.clients[self.client_address] AttributeError: 'WSGIServer' object has no attribute 'clients' {'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTPACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,/_;q=0.8', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'en,de;q=0.7,en-us;q=0.3', 'HTTP_CACHE_CONTROL': 'no-cache', 'HTTP_CONNECTION': 'keep-alive, Upgrade', 'HTTP_DNT': '1', 'HTTP_HOST': '192.168.1.7:8080', 'HTTP_ORIGIN': 'http://192.168.1.7:8080', 'HTTP_PRAGMA': 'no-cache', 'HTTP_SEC_WEBSOCKET_KEY': 'XJPF19+An4B5WaWQJQjedw==', 'HTTP_SEC_WEBSOCKET_VERSION': '13', 'HTTP_UPGRADE': 'websocket', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:33.0) Gecko/20100101 Firefox/33.0', 'PATH_INFO': '/control', 'QUERY_STRING': '', 'REMOTE_ADDR': '192.168.1.43', 'REMOTE_PORT': '50752', 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': '', 'SERVER_NAME': 'egpi', 'SERVER_PORT': '8080', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'gevent/1.0 Python/2.7', 'wsgi.errors': <open file '', mode 'w' at 0xb6cad0d0>, 'wsgi.input': <gevent.pywsgi.Input object at 0xb4c82270>, 'wsgi.multiprocess': False, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0), 'wsgi.websocket': <geventwebsocket.websocket.WebSocket object at 0xb4c7b688>, 'wsgi.websocket_version': '13'} failed with AttributeError

192.168.1.43 - - [2014-10-31 17:13:20] "GET /control HTTP/1.1" 101 129 0.060345 Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/gevent/pywsgi.py", line 508, in handle_one_response self.run_application() File "/usr/local/lib/python2.7/dist-packages/geventwebsocket/handler.py", line 63, in run_application self.run_websocket() File "/usr/local/lib/python2.7/dist-packages/geventwebsocket/handler.py", line 46, in run_websocket del self.server.clients[self.client_address] AttributeError: 'WSGIServer' object has no attribute 'clients' {'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTPACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,/_;q=0.8', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate', 'HTTP_ACCEPT_LANGUAGE': 'en,de;q=0.7,en-us;q=0.3', 'HTTP_CACHE_CONTROL': 'no-cache', 'HTTP_CONNECTION': 'keep-alive, Upgrade', 'HTTP_DNT': '1', 'HTTP_HOST': '192.168.1.7:8080', 'HTTP_ORIGIN': 'http://192.168.1.7:8080', 'HTTP_PRAGMA': 'no-cache', 'HTTP_SEC_WEBSOCKET_KEY': 'SsDXm0YTrr/Mgo5EDgfnNQ==', 'HTTP_SEC_WEBSOCKET_VERSION': '13', 'HTTP_UPGRADE': 'websocket', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:33.0) Gecko/20100101 Firefox/33.0', 'PATH_INFO': '/storage', 'QUERY_STRING': '', 'REMOTE_ADDR': '192.168.1.43', 'REMOTE_PORT': '50753', 'REQUEST_METHOD': 'GET', 'SCRIPT_NAME': '', 'SERVER_NAME': 'egpi', 'SERVER_PORT': '8080', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'gevent/1.0 Python/2.7', 'wsgi.errors': <open file '', mode 'w' at 0xb6cad0d0>, 'wsgi.input': <gevent.pywsgi.Input object at 0xb4c82650>, 'wsgi.multiprocess': False, 'wsgi.multithread': False, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0), 'wsgi.websocket': <geventwebsocket.websocket.WebSocket object at 0xb4c7b7a0>, 'wsgi.websocket_version': '13'} failed with AttributeError

192.168.1.43 - - [2014-10-31 17:13:20] "GET /storage HTTP/1.1" 101 129 0.059130

chron0 commented 10 years ago

Hmm, I've just tested this on the gentoo box and it works just as it is supposed to. The raspbian device is not available, as it went into the PiGI test. Did you install the packages (bottle/gevent) via apt-get or via pip? Do you know which versions of gevent/bottle are installed? Also, could you test if it works with chromium, so that we can exclude any client induced issues.

3eggert commented 10 years ago

I installed via pip, I checked and none is installed via apt in parallel. pip gives this version info for the installed packages:

root@egpi:~# pip freeze Warning: cannot find svn location for distribute==0.6.24dev-r0 RPi.GPIO==0.5.7 argparse==1.2.1 bottle==0.12.7

FIXME: could not find svn URL in dependency_links for this package:

distribute==0.6.24dev-r0 ez-setup==0.9 gevent==1.0.1 gevent-socketio==0.3.6 gevent-websocket==0.9.3 greenlet==0.4.5 kr-gevent-websocket==0.4 numpy==1.6.2 pifacecommon==4.0.0 pifacedigitalio==3.0.4 pygame==1.9.1release pygobject==3.8.2 pywsgi==0.9.0 websocket==0.2.1 wsgiref==0.1.2

chron0 commented 10 years ago

I've tested on gentoo and on raspbian on the pi, both times I could not reproduce the error. Both times simulation mode only. I don't believe that it will behave differently but I'll have to rig the other pi with the new image to be sure that the results are the same while interfacing real hardware .

This is the pip freeze from raspbian with some older deps (working):

root@raspberrypi:/opt/picoReflow# pip freeze
RPi.GPIO==0.5.3a
argparse==1.2.1
bottle==0.11.6
distribute==0.6.24dev-r0
ez-setup==0.9 
gevent==0.13.8
gevent-websocket==0.3.6
greenlet==0.4.1
leveldb==0.191
numpy==1.6.2
pifacecommon==3.1.2
pifacedigitalio==2.1.0
pygame==1.9.1release
wsgiref==0.1.2

After upgrading all required deps to present pip delivery (still working).

RPi.GPIO==0.5.3a
argparse==1.2.1
bottle==0.12.7
distribute==0.6.24dev-r0
ez-setup==0.9
gevent==1.0.1
gevent-websocket==0.3.6
greenlet==0.4.5
leveldb==0.191
numpy==1.6.2
pifacecommon==3.1.2
pifacedigitalio==2.1.0
pygame==1.9.1release
wsgiref==0.1.2

Now, being no python expert and not being able to reproduce locally, I would go with a hunch:

In your pip freeze I find kr-gevent-websocket. This reads awfully close to gevent-websocket (required) and I don't know or have this one on any of my test or production systems. If you can, could you try to temporarily remove it (depending on why you have it there in the first place) and see if it works then? That would at least move us forward to isolating the issue.

chron0 commented 10 years ago

I've also updated the README to make the installation process a bit more clear (for your reference as well)

3eggert commented 10 years ago

Thank you for the kr-gevent-websocket tip. I removed it, than gevent-websocket was not found anymore. Than I also removed gevent-websocket and reinstalled it! Now it seems to work. The only missing things are some hardware parts, which are on there way from china (-:

chron0 commented 10 years ago

Sweet :)