ajenti panel fails to load

Bug #1502455 reported by PLNech
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ajenti
New
Undecided
Unassigned

Bug Description

The login screen loads successfully and lets me input the default username and password,
but the panel refuses to load apart from the header bar, the "Feedback and help" left bar and the small light bulb (none of them being clickable). See attached screenshot of the panel.

When looking at the log files or running `ajenti-panel -v`, I see the following exception:

03.10.2015 11:24 compat.py:20 DEBUG [root] Popen: ./compile_resources.py nocompress
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gevent-1.1b5-py2.7-linux-x86_64.egg/gevent/greenlet.py", line 523, in run
    result = self._run(*self.args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/gevent-1.1b5-py2.7-linux-x86_64.egg/gevent/baseserver.py", line 153, in _close_when_done
    return handle(*args)
  File "/usr/local/lib/python2.7/dist-packages/gevent-1.1b5-py2.7-linux-x86_64.egg/gevent/server.py", line 130, in wrap_socket_and_handle
    return self.handle(ssl_socket, address)
  File "/usr/lib/python2.7/dist-packages/socketio/server.py", line 124, in handle
    handler.handle()
  File "/usr/local/lib/python2.7/dist-packages/gevent-1.1b5-py2.7-linux-x86_64.egg/gevent/pywsgi.py", line 371, in handle
    result = self.handle_one_request()
  File "/usr/local/lib/python2.7/dist-packages/gevent-1.1b5-py2.7-linux-x86_64.egg/gevent/pywsgi.py", line 575, in handle_one_request
    self.handle_one_response()
  File "/usr/lib/pymodules/python2.7/ajenti/http.py", line 25, in handle_one_response
    return SocketIOHandler.handle_one_response(self)
  File "/usr/lib/python2.7/dist-packages/socketio/handler.py", line 122, in handle_one_response
    return self._do_handshake(handshake_tokens.groupdict())
  File "/usr/lib/python2.7/dist-packages/socketio/handler.py", line 64, in _do_handshake
    self.write_smart(data)
  File "/usr/lib/python2.7/dist-packages/socketio/handler.py", line 88, in write_smart
    self.write_plain_result(data)
  File "/usr/lib/python2.7/dist-packages/socketio/handler.py", line 78, in write_plain_result
    ("Content-Type", "text/plain"),
  File "/usr/local/lib/python2.7/dist-packages/gevent-1.1b5-py2.7-linux-x86_64.egg/gevent/pywsgi.py", line 690, in start_response
    raise UnicodeError("The value must be a native string", header, value)
UnicodeError: ('The value must be a native string', 'Access-Control-Max-Age', 3600)
<Greenlet at 0x7faa946f9f50: _close_when_done(<socket at 0x7faa93e9eb90 fileno=[Errno 9] Bad fil, ('XX.XX.XX.XX', 41577))> failed with UnicodeError

Apparently, another project has the same exception thrown by gevent, as described here: https://github.com/iancmcc/ouimeaux/issues/103

This may be linked to gevent new changes (http://www.gevent.org/whatsnew_1_1.html):

> gevent.pywsgi.WSGIServer ensures that headers and the status line set by the application can be encoded in the ISO-8859-1 (Latin-1) charset and are of the native string type.
>
> Under gevent 1.0, non-bytes headers (that is, unicode since gevent 1.0 only ran on Python 2) were encoded according to the current default Python encoding. In some cases, this could allow non-Latin-1 characters to be sent in the headers, but this violated the HTTP specification, and their interpretation by the recipient is unknown. Now, a UnicodeError will be raised.

Revision history for this message
PLNech (f-ne-b) wrote :
Revision history for this message
PLNech (f-ne-b) wrote :

After more investigation on the affected system,
I was able to pinpoint the issue to socketio's transports.py and handler.py,
which both contained the following line:

            ("Access-Control-Max-Age", 3600),

changing it to

            ("Access-Control-Max-Age", "3600"),

successfully restored ajenti panel's functionality.

Do you think this should be reported to socketio/gevent maintainers?

Revision history for this message
Eugene Pankov (john-pankov) wrote :

I have already sent a pull request (including py3k support) to devs, but got no response so far.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.