AD2Pi & DSC PC1616 -Worked, now browser gets 502 Bad Gateway

General Discussion

AD2Pi & DSC PC1616 -Worked, now browser gets 502 Bad Gateway

Postby wilsonb » Mon Jul 27, 2015 8:57 am

Finally got communication working good with Alarmdecoder on Raspberry and DSC alarm. :D
Figured out through trial and error, and support how to get the correct settings done on Windows PC AlarmDecoder Keypad app and the webbapp (via browser)

Got most working , however for some reason the AlarmDecoder WebApp Keypad stopped working. :cry:
Now when trying to bring it up in a browser, I get 502 Bad Gateway , error.
"Services might still be starting - please wait and try again. If this continues, please let us know on GitHub. You can also email us at Support."


I tried restarting the Raspberry Pi- & manually restarting the services (nginx & Gunicorn) that seem to restart properly. But still get 502 error.
Restated services without a problem. (Maybe there is another service I am missing)
​pi@alarmdecoder /opt/alarmdecoder-webapp $ sudo service nginx restart
Restarting nginx: nginx.
pi@alarmdecoder /opt/alarmdecoder-webapp $ sudo service gunicorn restart
[ ok ] Stopping Gunicorn workers: [alarmdecoder].
[ ok ] Starting Gunicorn workers: [alarmdecoder].

Communication is good because I can communicate with Windows AlarmDecoder app.
wilsonb
Senior Nut
Senior Nut
 
Posts: 77
Joined: Sun Jul 26, 2015 4:14 pm

Re: AD2Pi & DSC PC1616 -Worked, now browser gets 502 Bad Gat

Postby kevin » Mon Jul 27, 2015 9:56 am

Please post contents of your /var/log/gunicorn/alarmdecoder.log as well as /opt/alarmdecoder-webapp/instance/logs/info.log - do note that once gunicorn is started, it does take quite some time for all the wsgi stuff to finish initializing etc.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: AD2Pi & DSC PC1616 -Worked, now browser gets 502 Bad Gat

Postby kevin » Mon Jul 27, 2015 10:31 am

Just so everybody is appraised to the solution here

We currently only support up to version 6.1.1 of pip - if you have updated pip beyond this version, you need to downgrade it to version 6.1.1.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: AD2Pi & DSC PC1616 -Worked, now browser gets 502 Bad Gat

Postby wilsonb » Mon Jul 27, 2015 1:08 pm

went ahead a reimaged the Raspberry image and configured..
All is good again. I backed up(exported) my settings (using settings in Alarmdecoder webapp) in case need to start over in the future..

Thanks
wilsonb
Senior Nut
Senior Nut
 
Posts: 77
Joined: Sun Jul 26, 2015 4:14 pm

Re: AD2Pi & DSC PC1616 -Worked, now browser gets 502 Bad Gat

Postby wilsonb » Mon Jul 27, 2015 2:43 pm

Well this is annoying.., it happened again and didnt make any changes since it was working... :evil:


alarmdecoder.log

[2015-07-27 20:09:30 +0000] [2657] [ERROR] Exception in worker process:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 507, in spawn_worker
worker.init_process()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/ggevent.py", line 192, in init_process
super(GeventWorker, self).init_process()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 124, in init_process
self.run()
File "/usr/local/lib/python2.7/dist-packages/socketio/sgunicorn.py", line 80, in run
**ssl_args
File "/usr/local/lib/python2.7/dist-packages/socketio/server.py", line 72, in __init__
address = args[0].cfg_addr[0]
AttributeError: 'socket' object has no attribute 'cfg_addr'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 507, in spawn_worker
worker.init_process()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/ggevent.py", line 192, in init_process
super(GeventWorker, self).init_process()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 124, in init_process
self.run()
File "/usr/local/lib/python2.7/dist-packages/socketio/sgunicorn.py", line 80, in run
**ssl_args
File "/usr/local/lib/python2.7/dist-packages/socketio/server.py", line 72, in __init__
address = args[0].cfg_addr[0]
AttributeError: 'socket' object has no attribute 'cfg_addr
wilsonb
Senior Nut
Senior Nut
 
Posts: 77
Joined: Sun Jul 26, 2015 4:14 pm

Re: AD2Pi & DSC PC1616 -Worked, now browser gets 502 Bad Gat

Postby kevin » Mon Jul 27, 2015 2:49 pm

You can ignore that error, that always happens, we have yet to suppress it

Your actual error is:

Code: Select all
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 507, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/ggevent.py", line 192, in init_process
    super(GeventWorker, self).init_process()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 118, in init_process
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 355, in import_app
    __import__(module)
  File "/opt/alarmdecoder-webapp/wsgi.py", line 24, in <module>
    from ad2web import create_app
  File "/opt/alarmdecoder-webapp/ad2web/__init__.py", line 3, in <module>
    from app import create_app
  File "/opt/alarmdecoder-webapp/ad2web/app.py", line 14, in <module>
    from alarmdecoder import AlarmDecoder
  File "/opt/alarmdecoder/alarmdecoder/__init__.py", line 3, in <module>
    import alarmdecoder.devices
  File "/opt/alarmdecoder/alarmdecoder/devices.py", line 26, in <module>
    from OpenSSL import SSL, crypto
  File "/usr/local/lib/python2.7/dist-packages/pyOpenSSL-0.15.1-py2.7.egg/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/local/lib/python2.7/dist-packages/pyOpenSSL-0.15.1-py2.7.egg/OpenSSL/rand.py", line 11, in <module>
    from OpenSSL._util import (
  File "/usr/local/lib/python2.7/dist-packages/pyOpenSSL-0.15.1-py2.7.egg/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/usr/local/lib/python2.7/dist-packages/cryptography-0.8.2-py2.7-linux-armv7l.egg/cryptography/hazmat/bindings/openssl/binding.py", line 60, in <module>
    class Binding(object):
  File "/usr/local/lib/python2.7/dist-packages/cryptography-0.8.2-py2.7-linux-armv7l.egg/cryptography/hazmat/bindings/openssl/binding.py", line 109, in Binding
    libraries=_get_libraries(sys.platform)
  File "/usr/local/lib/python2.7/dist-packages/cryptography-0.8.2-py2.7-linux-armv7l.egg/cryptography/hazmat/bindings/utils.py", line 97, in build_ffi_for_binding
    extra_link_args=extra_link_args,
  File "/usr/local/lib/python2.7/dist-packages/cryptography-0.8.2-py2.7-linux-armv7l.egg/cryptography/hazmat/bindings/utils.py", line 106, in build_ffi
    ffi.cdef(cdef_source)
  File "/usr/local/lib/python2.7/dist-packages/cffi-1.0.0b2-py2.7-linux-armv7l.egg/cffi/api.py", line 107, in cdef
    self._parser.parse(csource, override=override, packed=packed)
  File "/usr/local/lib/python2.7/dist-packages/cffi-1.0.0b2-py2.7-linux-armv7l.egg/cffi/cparser.py", line 166, in parse
    self._internal_parse(csource)
  File "/usr/local/lib/python2.7/dist-packages/cffi-1.0.0b2-py2.7-linux-armv7l.egg/cffi/cparser.py", line 172, in _internal_parse
    ast, macros, csource = self._parse(csource)
  File "/usr/local/lib/python2.7/dist-packages/cffi-1.0.0b2-py2.7-linux-armv7l.egg/cffi/cparser.py", line 127, in _parse
    ast = _get_parser().parse(csource)
  File "/usr/local/lib/python2.7/dist-packages/pycparser-2.12-py2.7.egg/pycparser/c_parser.py", line 138, in parse
    debug=debuglevel)
  File "/usr/local/lib/python2.7/dist-packages/pycparser-2.12-py2.7.egg/pycparser/ply/yacc.py", line 265, in parse
    return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
  File "/usr/local/lib/python2.7/dist-packages/pycparser-2.12-py2.7.egg/pycparser/ply/yacc.py", line 973, in parseopt_notrack
    state = goto[statestack[-1]][pname]
KeyError: 'struct_dec'


My question is: What were you doing in the webapp when it was working to where it is not working? Please verify your nginx and gunicorn versions are the same as we shipped with. Nginx should be 1.7.4 and gunicorn should be gunicorn (version 19.3.0)

Once setup and working, I very much recommend NOT touching the filesystem, including apt-get update/upgrade as we have installed and prepared tightly coupled specific versions of packages to make our image work.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: AD2Pi & DSC PC1616 -Worked, now browser gets 502 Bad Gat

Postby wilsonb » Mon Jul 27, 2015 4:35 pm

Was working and didn't do anything. Just time past.

The correct versions and when restarting those services, they start fine. It seems to be partially working because the page comes up with;
"Sign in
Services might still be starting - please wait and try again. If this continues, please let us know on GitHub. You can also email us at Support."

nginx version: nginx/1.7.4
built by gcc 4.6.3 (Debian 4.6.3-14+rpi1)
TLS SNI support enabled

gunicorn (version 19.3.0)
Last edited by wilsonb on Mon Jul 27, 2015 4:44 pm, edited 1 time in total.
wilsonb
Senior Nut
Senior Nut
 
Posts: 77
Joined: Sun Jul 26, 2015 4:14 pm

Re: AD2Pi & DSC PC1616 -Worked, now browser gets 502 Bad Gat

Postby kevin » Mon Jul 27, 2015 4:43 pm

The only time I've seen errors like this is when the filesystem has been updated via apt-get. This is way down deep in the libraries we utilize, not something we can easily fix.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: AD2Pi & DSC PC1616 -Worked, now browser gets 502 Bad Gat

Postby wilsonb » Mon Jul 27, 2015 4:47 pm

OK, will reimage again and WILL NOT do an update.

The only changes I make is run Raspiconfig and expand the partition, set local to US En, timezone. Change root & pi password
and apt-get update/ upgrade
The standard stuff and it was working.
wilsonb
Senior Nut
Senior Nut
 
Posts: 77
Joined: Sun Jul 26, 2015 4:14 pm

Re: AD2Pi & DSC PC1616 -Worked, now browser gets 502 Bad Gat

Postby kevin » Mon Jul 27, 2015 4:49 pm

All except the apt-get stuff should be fine to do! It's the specific versions of things - in a future image we will have all of the specific stuff in an apt-hold queue to prevent this. Or find a way around getting newer versions of things - but when API's change that becomes a problem.

If it begins to fail for some reason after this - I suspect maybe a power or SD Card issue might be at play. Very strange for it to happen on known good configurations.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Next

Return to General

Who is online

Users browsing this forum: No registered users and 17 guests

cron