liftoff / GateOne

Gate One is an HTML5-powered terminal emulator and SSH client
http://liftoffsoftware.com/Products/GateOne
Other
6.28k stars 925 forks source link

Uncaught exception in /ws #466

Open DonRichie opened 10 years ago

DonRichie commented 10 years ago

Hi, i updated my gateone instance by using git pull service gateone stop python setup.py install service gateone start

The server starts but when a client wants to connect the server says:

[E 140924 01:51:26 websocket:325] Uncaught exception in /ws Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/tornado-3.2-py2.7-linux-x86_64.egg/tornado/websocket.py", line 322, in wrapper return callback(_args, *_kwargs) File "/usr/local/lib/python2.7/dist-packages/gateone-1.2.0-py2.7.egg/gateone/core/server.py", line 1595, in open logging.debug("open() origin: %s" % self.origin) AttributeError: 'ApplicationWebSocket' object has no attribute 'origin'

What could make this happen and how to fix that?

DonRichie commented 10 years ago

I also checked out the version v1.1 to see if this makes a difference. Unfortunaly not

mmattel commented 10 years ago

I have the same problem. Ubuntu 14.04 latest patch.

I did a git clone in July and had a working environment up to yesterday. Yesterday I did a git clone into a empty directory and sudo python setup.py install I can login, but afterwards it says "Attempting to connect to the Gate One server..."

Seems maybe related to #464 I please for a urgent fix.

Here are the informations from the gateone.log

[I 141031 09:19:51 app_terminal:262] Active Terminal Plugins: bookmarks, convenience, example, html, logging, notice, playback, ssh [E 141031 09:19:51 websocket:319] Uncaught exception in /ws Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/tornado-3.2.2-py2.7-linux-x86_64.egg/tornado/websocket.py", line 316, in wrapper return callback(_args, *_kwargs) File "/usr/local/lib/python2.7/dist-packages/gateone-1.2.0-py2.7.egg/gateone/core/server.py", line 1595, in open logging.debug("open() origin: %s" % self.origin) AttributeError: 'ApplicationWebSocket' object has no attribute 'origin'

mmattel commented 10 years ago

Update: As by default phyton 2.7 was used in my Ubuntu system, I forced a setup with python 3.4 To have a clean install, I stopped gateone, renamed all old installs paths and files. sudo python3.4 setup.py install After that, I adopted the newly created config files to fit my needs, started gateone and logged in gateone with my browser.

I now get a different screen on the browser. Close to all ist present, but instead the normal screen where I can click on to start a session, I get: "Gate One - Applications" The plus symbol on the right is inactive, the other symbols are working

Following error messages are in gateone.log (some internal infos eg at "Sending" have been cut out)

Error in WebSocket action, go:authenticate: 'bytes' object has no attribute 'format' (/usr/local/lib/python3.4/dist-packages/gateone-1.2.0-py3.4.egg/gateone/applications/terminal/app_terminal.py line 452)

(this is the corresponding code fragment ... sub_app['icon'] = resource_string( 'gateone.applications.terminal', '/templates/command_icon.svg').format(cmd=sub_app['name'])

INFO: .format is not longer supported/allowed on binary objects in python >=3 ...)

Sending: black.css Sending: terminal.css Sending: terminal.js Sending: terminal_input.js Sending: example.js Sending: 1smoothie.js Sending: 1hmac_sha1.js Sending: logging.js Sending: playback.js Sending: ssh.js Sending: convenience.js Sending: bookmarks.js Sending: 256_colors.css Sending: printing.css

Error in WebSocket action, terminal:get_webworker: b'// A Web Worker for processing incoming text\nvar consoleLog = [],\n SCREEN = [];\nvar log = function(msg) {\n // Appends msg to a global consoleLog variable which will be handled by the caller\n consoleLog.push(msg);\n}\nvar transformText = function(text, pattern, newString) {\n // Given text, find all strings matching pattern and turn them into clickable links using newString\n // If pattern is not provided, simply transforms URLs into clickable links.\n // Here\'s an example of replacing hypothetical ticket numbers with clickable links:\n // transformText("Please see ticket IM123456789", /(\bIM\d{9,10}\b)/g, "<a href=\'https://support.company.com/tracker?ticket=$1\' target=\'new\'>$1")\n if (!pattern) {\n pattern = /(\b(https?|web+ssh|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~|!:,.;]*[-A-Z0-9+&@#\/%=~|])(?!.*a>)/ig;\n }\n if (!newString) {\n newString = "<a href=\'$1\' target=\'new\'>$1";\n }\n return text.replace(pattern, newString);\n};\nvar processLines = function(lines, textTransforms) {\n var output = []\n for (var i=0; i < lines.length; i++) {\n var line = lines[i];\n if (line == null) {\n output[i] = ""; // An empty string will do (emulates unchanged)\n } else if (line.length) {\n // Trim trailing whitespace only if the line isn\'t just full of whitespace\n var trimmedLine = line.replace(/\s+$/g, "");\n if (!trimmedLine.length) {\n // Need a space here so the browser gives the block some height\n trimmedLine = " ";\n // NOTE: There\'s logic in terminal.js to ensure trailing whitespace gets removed when copying text from a terminal\n }\n line = trimmedLine;\n output[i] = line;\n } else {\n // Line is unchanged\n output[i] = \'\';\n }\n }\n outText = output.join(\'\n\')\n // Linkify and transform the text inside the screen before we push it\n for (var trans in textTransforms) {\n // Have to convert the regex to a string and use eval since Firefox can\'t seem to pass regexp objects to Web Workers.\n var name = textTransforms[trans][\'name\'],\n pattern = textTransforms[trans][\'pattern\'],\n newString = textTransforms[trans][\'newString\'];\n try {\n pattern = eval(pattern);\n } catch(e) {\n // A SyntaxError likely means this is a function\n if (e instanceof SyntaxError) {\n try {\n pattern = Function("return " + pattern)();\n } catch(e) {\n log("Error transforming text inside of the term_ww.js Worker: " + e + ", name: " + name + ", pattern: \'" + pattern + "\'");\n }\n }\n }\n if (typeof(pattern) == "function") {\n outText = pattern(outText);\n } else {\n outText = transformText(outText, pattern, newString);\n }\n }\n output = transformText(outText).split(\'\n\'); // Convert links to anchor tags and convert back to an array\n return output;\n}\nvar processScreen = function(scrollback, termUpdateObj, prefs, textTransforms, checkBackspace) {\n // Do all the necessary client-side processing of the terminal screen and scrollback buffer. The idea being that a web worker doing this stuff should make Gate One more responsive (at the client).\n // scrollback: go.terminals[term][\'scrollback\']\n // termUpdateObj: The object containing the terminal screen/scrollback provided by the server\n // termTitle: u.getNode(\'#\' + go.prefs.prefix + \'term\' + term).title (since we can\'t query the DOM from within a Worker)\n // prefs: GateOne.prefs\n // textTransforms: Textual transformations that will be passed to transformText(),\n // checkBackspace: null or the current value of the backspace key (if we\'re to check it).\n var term = termUpdateObj[\'term\'],\n screen = [],\n incoming_scrollback = termUpdateObj[\'scrollback\'],\n rateLimiter = termUpdateObj[\'ratelimiter\'],\n backspace = "",\n outputObj = {\'term\': term};\n if (!scrollback.length) {\n scrollback = [];\n }\n if (incoming_scrollback.length) {\n // Process the scrollback buffer before we concatenate it\n incoming_scrollback = processLines(incoming_scrollback, textTransforms);\n scrollback = scrollback.concat(incoming_scrollback);\n }\n // Now trim the array to match the go.prefs[\'scrollback\'] setting\n if (scrollback.length > prefs.scrollback) {\n scrollback.reverse();\n scrollback.length = prefs.scrollback; // I love that Array().length isn\'t just a read-only value =)\n scrollback.reverse(); // Put it back in the proper order\n }\n if (checkBackspace) {\n // Find the first non-empty line and check for ^H and ^? then return the opposite value\n for (var i=0; i < termUpdateObj[\'screen\'].length; i++) {\n if (termUpdateObj[\'screen\'][i].length) {\n if (termUpdateObj[\'screen\'][i].indexOf(\'\') != -1) { // Only care about lines that have the cursor in them\n var beforeCursor = termUpdateObj[\'screen\'][i].split(\'\')[0];\n if (beforeCursor.substr(beforeCursor.length - 2) == \'^H\') {\n if (checkBackspace != String.fromCharCode(127)) {\n backspace = String.fromCharCode(127); // Switch to ^H\n }\n } else if (beforeCursor.substr(beforeCursor.length - 2) == \'^?\') {\n if (checkBackspace != String.fromCharCode(8)) {\n backspace = String.fromCharCode(8); // Switch to ^?\n }\n }\n }\n }\n }\n }\n for (var i=0; i<scrollback.length; i++) {\n if (scrollback[i].indexOf("") != 0) {\n scrollback[i] = \'\' + scrollback[i] + \'\';\n }\n }\n textTransforms[\'contenteditable cursor\'] = {\n \'name\': \'contentenditable cursor\',\n \'pattern\': \'/\<span class="\xe2\x9c\x88cursor"\>/g\',\n \'newString\': \'\'\n };\n // Assemble the entire screen from what the server sent us (lines that haven\'t changed get sent as null)\n screen = processLines(termUpdateObj[\'screen\'], textTransforms);\n outputObj[\'screen\'] = screen;\n outputObj[\'scrollback\'] = scrollback;\n outputObj[\'backspace\'] = backspace;\n outputObj[\'log\'] = consoleLog.join(\'\n\');\n return outputObj\n}\nself.addEventListener(\'message\', function(e) {\n var data = e.data,\n term = data.term,\n cmds = data.cmds,\n text = data.text,\n scrollback = data.scrollback,\n checkBackspace = data.checkBackspace,\n termUpdateObj = data.termUpdateObj,\n prefs= data.prefs,\n textTransforms = data.textTransforms,\n result;\n if (cmds) {\n cmds.forEach(function(cmd) {\n switch (cmd) {\n case \'transformText\':\n // Linkify links before anything else so we don\'t clobber any follow-up linkification\n text = transformText(text);\n if (textTransforms) {\n for (var trans in textTransforms) {\n // Have to convert the regex to a string and use eval since Firefox can\'t seem to pass regexp objects to Web Workers.\n var pattern = eval(textTransforms[trans][\'pattern\']),\n newString = textTransforms[trans][\'newString\'];\n text = transformText(text, pattern, newString);\n }\n }\n break;\n case \'processScreen\':\n result = processScreen(scrollback, termUpdateObj, prefs, textTransforms, checkBackspace);\n break;\n default:\n self.postMessage(\'Unknown command: \' + cmds);\n break\n };\n });\n if (text) {\n self.postMessage({\'text\': text, \'term\': term, \'log\': consoleLog.join(\'\n\')});\n } else if (result) {\n self.postMessage(result);\n }\n result = null;\n consoleLog = []; // Reset\n }\n}, false);\n\n//# sourceURL=/terminal/static/webworkers/term_ww.js\n' is not JSON serializable (/usr/lib/python3.4/json/encoder.py line 173)

Sync check: font.css Sync check: default.css

Client Logging: b'2014-10-31 20:01:06 INFO terminal: The database needs to be created or updated. Creating/upgrading database...' Client Logging: b'2014-10-31 20:01:06 INFO Creating new object store: scrollback' Client Logging: b'2014-10-31 20:01:06 INFO terminal database creation/upgrade complete'

Sending: font.css Sending: default.css

Client Logging: b'2014-10-31

mmattel commented 10 years ago

Following seems to catch my eyes:

When clone the latest code from github und you install with python 2.7 you get errors in

File "/usr/local/lib/python2.7/dist-packages/tornado-3.2.2-py2.7-linux-x86_64.egg/tornado/websocket.py", line 316, in wrapper return callback(_args, *_kwargs) File "/usr/local/lib/python2.7/dist-packages/gateone-1.2.0-py2.7.egg/gateone/core/server.py", line 1595, in open logging.debug("open() origin: %s" % self.origin) AttributeError: 'ApplicationWebSocket' object has no attribute 'origin'

When clone the latest code from github und you install with python 3.4 you get errors in

Error in WebSocket action, go:authenticate: 'bytes' object has no attribute 'format' (/usr/local/lib/python3.4/dist-packages/gateone-1.2.0-py3.4.egg/gateone/applications/terminal/app_terminal.py line 452)

So in any case it is a mess...

DonRichie commented 10 years ago

Hey somebody posted on my issue :+1:

My Gateone is still down since the error showed up. Would like to turn it back on if somebody figures out a solution

mmattel commented 10 years ago

Info: By chance, I found a old copy of my VM where I had the working version in.

These are the commit enries from gateone/__init__.py "working" ... "20140609191913" "defect" ... "20140920142503"

sylvainpetit commented 10 years ago

Same issue on debian jessie (python 2.7, tornado 3.2.2).

maxs commented 9 years ago

I have the same problem. Fedora 19, I did a git clone into a empty directory and sudo python setup.py install and then run with gateone --logging=debug and got the following error:

[E 141128 12:04:47 websocket:325] Uncaught exception in /ws Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/tornado-3.2.1-py2.7-linux-x86_64.egg/tornado/websocket.py", line 322, in wrapper return callback(_args, *_kwargs) File "/usr/lib/python2.7/site-packages/gateone-1.2.0-py2.7.egg/gateone/core/server.py", line 1595, in open logging.debug("open() origin: %s" % self.origin) AttributeError: 'ApplicationWebSocket' object has no attribute 'origin'

DonRichie commented 9 years ago

I tested using gateone today with a fresh install. The same error Message occured when the browser says "attemting to connect to server"