LunaNode / lobster

Hourly billing panel for virtual machines
http://lobster.lunanode.com
Other
84 stars 22 forks source link

noVNC Issue #45

Closed rezabagh closed 8 years ago

rezabagh commented 8 years ago

hello,

there is an issue with noVNC when i open VNC panel via link http://IP/panel/vm/6/vnc

there is a red error message " Server disconnected (code: 1006)" when i look into this error there is below error actually :

:6080/include/websock.js:292

WebSocket connection to 'ws://IP:6080/websockify?token=dxwzay24q6nw4rko5c8pd5dncov8mgy8' failed: Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received

Msg: Server disconnected (code: 1006)

Util.Error @ util.js:220 util.js:218

Please NOTE i replace my server address with IP here for security reason .

Thank you for any advise .

uakfdotb commented 8 years ago

What browser are you using? Does it work in Firefox?

Or have you tried connecting with telnet to verify the program is listening on IP:6080?

sabdsouza commented 8 years ago

Hello uakfdotb, I have installed lobster on server, when running ./lobster_x86_64 lobster.cfg the telnet is not working, when running ./utils/launch.sh --vnc hostname:5901 telnet is working however connection closing after few secs when I run both ./utils/launch.sh --vnc hostname:5901 and ./lobster_x86_64 lobster.cfg and try connecting vnc through lobster admin area the error show 6080 is already in use.

8139 pts/1 S+ 0:00 python /root/lobster-release/novnc/utils/websockify/run --web /root/lobster-release/novnc 6080 hostname:5901

Also have tigervnc on server, not sure why it is running on 5904 port and able to telnet

CentOS release 6.5 (Final)

rezabagh commented 8 years ago

Hello,

Thank you for my friend @sabdsouza for the technical information regard this issue. also i have checked this in Firefox browser and still it does not work with the same error code, select no sub-protocol!: util.js:220:43 Util.init_logging/Util.Error() util.js:220 Websock.prototype.open/this._websocket.onopen<() Failed to connect to server (code: 1006) util.js:220:43 Util.init_logging/Util.Error() util.js:220 RFB.prototype._updateState() rfb.js:468 RFB.prototype._fail() rfb.js:538 RFB/<() rfb.js:204 Websock.prototype.open/this._websocket.onclose<() any advise ? thank you

obaviet commented 8 years ago

rezabagh! How do you install lobster?can you share me step by step?I have read Getting Started but i do not understand

uakfdotb commented 8 years ago

@sabdsouza Lobster only initializes the VNC server when a module requests it (which occurs when a user hits the VNC button for a VM backend that provides console access via noVNC).

@rezabagh I made a fix so that debug messages for Websockify object will be printed if debug flag is set in the configuration file. Can you get the new release from https://github.com/LunaNode/lobster-release, make sure debug = true in lobster.cfg, and then check the log when using the VNC button?

@obaviet see https://github.com/LunaNode/lobster/wiki/GettingStarted

sabdsouza commented 8 years ago

@uakfdotb

2016/02/15 14:02:14 SELECT id, user_id FROM images WHERE status = 'pending' ORDER BY RAND() LIMIT 3 on [] 2016/02/15 14:02:18 Request [119.159.123.170:49518] GET /panel/vm/6/vnc 2016/02/15 14:02:18 SELECT user_id, admin, original_id, regenerate FROM sessions WHERE uid = ? AND active_time > DATE_SUB(NOW(), INTERVAL 1 HOUR) on [bb9e5b7c043dd9d1b52189101eb041939bfa0405aacd8bf84df9a1c515c17cc1] 2016/02/15 14:02:18 SELECT vms.id, vms.user_id, vms.region, vms.name, vms.identification, vms.status, vms.task_pending, vms.external_ip, vms.private_ip, vms.time_created, vms.suspended, vms.plan_id, plans.name, plans.price, plans.ram, plans.cpu, plans.storage, plans.bandwidth FROM vms, plans WHERE vms.plan_id = plans.id AND vms.id = ? AND vms.user_id = ? ORDER BY id DESC on [6 1] 2016/02/15 14:02:18 vmVnc(6) 2016/02/15 14:02:18 UPDATE sessions SET user_id = ?, admin = ?, original_id = ?, regenerate = ?, active_time = NOW() WHERE uid = ? on [1 true 0 false bb9e5b7c043dd9d1b52189101eb041939bfa0405aacd8bf84df9a1c515c17cc1] 2016/02/15 14:02:19 SELECT id, user_id FROM images WHERE status = 'pending' ORDER BY RAND() LIMIT 3 on []

This is received when Login Lobster > Select VM > Click VNC button

sabdsouza commented 8 years ago

[novnc] url = http://domain.com:6080/vnc_auto.html?token=TOKEN&password=PASSWORD listen = :6080

uakfdotb commented 8 years ago

@sabdsouza is that with the latest version that was pushed earlier today? md5sum lobster_x86_64 should be bb59abfa9308091fa01c0a6990e38c75

sabdsouza commented 8 years ago

@uakfdotb I just now did git clone https://github.com/LunaNode/lobster-release.git copied oldlocation/lobster.cfg and oldlocation/lobster.cfg.json to newlocation

2016/02/15 14:21:45 SELECT id, user_id FROM images WHERE status = 'pending' ORDER BY RAND() LIMIT 3 on [] 2016/02/15 14:21:50 SELECT id, user_id FROM images WHERE status = 'pending' ORDER BY RAND() LIMIT 3 on [] 2016/02/15 14:21:52 Request [119.159.123.170:49834] GET /panel/vm/6/vnc 2016/02/15 14:21:52 SELECT user_id, admin, original_id, regenerate FROM sessions WHERE uid = ? AND active_time > DATE_SUB(NOW(), INTERVAL 1 HOUR) on [5c1688a2ec329e7dcafeb753cf827ec8744571516ad32ecca2a1c50fb7823b6c] 2016/02/15 14:21:52 SELECT vms.id, vms.user_id, vms.region, vms.name, vms.identification, vms.status, vms.task_pending, vms.external_ip, vms.private_ip, vms.time_created, vms.suspended, vms.plan_id, plans.name, plans.price, plans.ram, plans.cpu, plans.storage, plans.bandwidth FROM vms, plans WHERE vms.plan_id = plans.id AND vms.id = ? AND vms.user_id = ? ORDER BY id DESC on [6 1] 2016/02/15 14:21:52 vmVnc(6) 2016/02/15 14:21:53 UPDATE sessions SET user_id = ?, admin = ?, original_id = ?, regenerate = ?, active_time = NOW() WHERE uid = ? on [1 true 0 false 5c1688a2ec329e7dcafeb753cf827ec8744571516ad32ecca2a1c50fb7823b6c] 2016/02/15 14:21:55 SELECT id, user_id FROM images WHERE status = 'pending' ORDER BY RAND() LIMIT 3 on [] 2016/02/15 14:21:57 Initializing connection from 119.159.123.170:49844 to 142.147.96.1306002 2016/02/15 14:21:57 dial tcp: missing port in address 142.147.96.1306002 2016/02/15 14:22:00 SELECT id, user_id FROM images WHERE status = 'pending' ORDER BY RAND() LIMIT 3 on [] 2016/02/15 14:22:05 SELECT id, user_id FROM images WHERE status = 'pending' ORDER BY RAND() LIMIT 3 on []

uakfdotb commented 8 years ago

Ah I see, the websockify seems to be working correctly but the SolusVM VMI is not passing the correct target address. I pushed another update, can you see if it works now?

sabdsouza commented 8 years ago

Chrome show still same error, however firefox showing Starting VNC handshake and page stays this way

sabdsouza commented 8 years ago

2016/02/15 14:38:21 Request [119.159.123.170:50073] GET /panel/vm/6/vnc 2016/02/15 14:38:21 SELECT user_id, admin, original_id, regenerate FROM sessions WHERE uid = ? AND active_time > DATE_SUB(NOW(), INTERVAL 1 HOUR) on [17e322baf424beeaec04f9e23c8fde1b91cdc284fc177ad1a453c8ccf028ff51] 2016/02/15 14:38:21 SELECT vms.id, vms.user_id, vms.region, vms.name, vms.identification, vms.status, vms.task_pending, vms.external_ip, vms.private_ip, vms.time_created, vms.suspended, vms.plan_id, plans.name, plans.price, plans.ram, plans.cpu, plans.storage, plans.bandwidth FROM vms, plans WHERE vms.plan_id = plans.id AND vms.id = ? AND vms.user_id = ? ORDER BY id DESC on [6 1] 2016/02/15 14:38:21 vmVnc(6) 2016/02/15 14:38:21 UPDATE sessions SET user_id = ?, admin = ?, original_id = ?, regenerate = ?, active_time = NOW() WHERE uid = ? on [1 true 0 false 17e322baf424beeaec04f9e23c8fde1b91cdc284fc177ad1a453c8ccf028ff51] 2016/02/15 14:38:22 SELECT id, user_id FROM images WHERE status = 'pending' ORDER BY RAND() LIMIT 3 on [] 2016/02/15 14:38:24 Initializing connection from 119.159.123.170:50100 to 142.147.96.130:6002 2016/02/15 14:38:27 SELECT id FROM vms WHERE time_billed < DATE_SUB(NOW(), INTERVAL ? HOUR) on [1] 2016/02/15 14:38:27 SELECT id FROM users WHERE last_billing_notify < DATE_SUB(NOW(), INTERVAL 24 HOUR) on [] 2016/02/15 14:38:27 SELECT region, bandwidth_used, bandwidth_additional, bandwidth_billed, bandwidth_notified_percent FROM region_bandwidth WHERE user_id = ? on [2] 2016/02/15 14:38:27 SELECT credit, email, TIMESTAMPDIFF(HOUR, last_billing_notify, NOW()), billing_low_count FROM users WHERE id = ? AND last_billing_notify < DATESUB(NOW(), INTERVAL 24 HOUR) AND (SELECT COUNT() FROM vms WHERE vms.user_id = users.id) > 0 on [2] 2016/02/15 14:38:27 SELECT region, bandwidth_used, bandwidth_additional, bandwidth_billed, bandwidth_notified_percent FROM region_bandwidth WHERE user_id = ? on [3] 2016/02/15 14:38:27 SELECT credit, email, TIMESTAMPDIFF(HOUR, last_billing_notify, NOW()), billing_low_count FROM users WHERE id = ? AND last_billing_notify < DATESUB(NOW(), INTERVAL 24 HOUR) AND (SELECT COUNT() FROM vms WHERE vms.user_id = users.id) > 0 on [3] 2016/02/15 14:38:27 UPDATE users SET time_billed = NOW() WHERE time_billed = 0 on [] 2016/02/15 14:38:27 SELECT id, TIMESTAMPDIFF(HOUR, time_billed, NOW()) FROM users WHERE status = 'active' AND TIMESTAMPDIFF(HOUR, time_billed, NOW()) > 0 on [] 2016/02/15 14:38:27 DELETE FROM form_tokens WHERE time < DATE_SUB(NOW(), INTERVAL 1 HOUR) on [] 2016/02/15 14:38:27 DELETE FROM sessions WHERE active_time < DATE_SUB(NOW(), INTERVAL 1 HOUR) on [] 2016/02/15 14:38:27 DELETE FROM antiflood WHERE time < DATE_SUB(NOW(), INTERVAL 2 HOUR) on [] 2016/02/15 14:38:27 DELETE FROM pwreset_tokens WHERE time < DATE_SUB(NOW(), INTERVAL ? MINUTE) on [60]

uakfdotb commented 8 years ago

OK, I am not able to reproduce issue with stuck at "Starting VNC handshake" (can you verify you are able to reach 142...*:6002 from the machine where Lobster is running), but I do see the issue in Chromium; it looks like something is ignored by websockify module which is making Chromium sad. I will look into the latter issue.

sabdsouza commented 8 years ago

Trying 142.147.96.130... Connected to 142.147.96.130. Escape character is '^]'. RFB 003.008

uakfdotb commented 8 years ago

@sabdsouza looks like the issue with Chromium is the same as the issue with Firefox -- apparently at some point the browsers implemented binary websocket communication subprotocol, and now they send Sec-Websocket-Protocol per RFC and expect Sec-Websocket-Protocol in the response header as well. I've updated the code so that Sec-Websocket-Protocol will be set to base64 if that is available, otherwise it will take the first subprotocol offered by the client. If none are offered then Sec-Websocket-Protocol in response will not be set.

Thanks for testing these updates :)

sabdsouza commented 8 years ago

@uakfdotb the screen is still stuck on the starting vnc handshake. btw

package golang.org/x/crypto: no buildable Go source files in /usr/local/go/bin/src/golang.org/x/crypto package code.google.com/p/gcfg: unable to detect version control system for code.google.com/ path

I received these errors when going through https://github.com/LunaNode/lobster/blob/master/INSTALL

uakfdotb commented 8 years ago

@sabdsouza you are still having issues with the binary where md5sum is e414e53601abd76fb998026e4b637cc7 ?

Regarding gcfg error, it is because code.google.com was decommissioned. I've updated the code to use github.com/scalingdata/gcfg instead.

sabdsouza commented 8 years ago

2016/02/15 15:56:11 SELECT id, user_id FROM images WHERE status = 'pending' ORDER BY RAND() LIMIT 3 on [] 2016/02/15 15:56:11 Request [119.159.123.170:51247] GET /panel/vm/6/vnc 2016/02/15 15:56:11 SELECT user_id, admin, original_id, regenerate FROM sessions WHERE uid = ? AND active_time > DATE_SUB(NOW(), INTERVAL 1 HOUR) on [f7bb5195e2e81154a319e6ea8501e73ea3cd340081029b5ea7dd2895e4741fe5] 2016/02/15 15:56:11 SELECT vms.id, vms.user_id, vms.region, vms.name, vms.identification, vms.status, vms.task_pending, vms.external_ip, vms.private_ip, vms.time_created, vms.suspended, vms.plan_id, plans.name, plans.price, plans.ram, plans.cpu, plans.storage, plans.bandwidth FROM vms, plans WHERE vms.plan_id = plans.id AND vms.id = ? AND vms.user_id = ? ORDER BY id DESC on [6 1] 2016/02/15 15:56:11 vmVnc(6) 2016/02/15 15:56:12 UPDATE sessions SET user_id = ?, admin = ?, original_id = ?, regenerate = ?, active_time = NOW() WHERE uid = ? on [1 true 0 false f7bb5195e2e81154a319e6ea8501e73ea3cd340081029b5ea7dd2895e4741fe5] 2016/02/15 15:56:14 Initializing connection from 119.159.123.170:51258 to 142.147.96.130:6002 2016/02/15 15:56:16 SELECT id, user_id FROM images WHERE status = 'pending' ORDER BY RAND() LIMIT 3 on []

uakfdotb commented 8 years ago

So is it that in both Firefox and Chrome it is stuck on Starting VNC handshake (and no longer has the "Sent non-empty 'Sec-WebSocket-Protocol" error in Chrome)?

sabdsouza commented 8 years ago

Yes both Firefox and Chrome is on Starting VNC handshake and no errors when I check with Ctrl+Shift+J

Msg: noVNC ready: native WebSockets, canvas rendering util.js:218 util.js:218 Msg: Starting VNC handshake

uakfdotb commented 8 years ago

If you open up Network tab and reload the VNC page, what do you see for the value of Sec-WebSocket-Protocol under the response headers?

Also, can you add a debug statement after the remote connection is initialized to verify that that step is succeeding?

    sock, err := net.Dial("tcp", target.ipport)
    if err != nil {
            if this.Debug {
                    log.Print(err)
            }
            return
    }
    defer sock.Close()
    log.Println("remote connection initialized")

So add the last log.Println line above in websockify/websockify.go.

sabdsouza commented 8 years ago

I did not understand, I cannot find websockify/websockify.go and also the Network tab in my laptop or Firefox

sabdsouza commented 8 years ago

@uakfdotb if you want we can provide ssh details to you, if would be great if you can fix the issue, will be much appreciated

rezabagh commented 8 years ago

@uakfdotb Yes , that would be a great help to us if you could take a deep look at noVNC issue in the server . Thank you

uakfdotb commented 8 years ago

Sure, it would also help me to fix this issue! Can you e-mail me at fbastani@perennate.com?

rezabagh commented 8 years ago

@uakfdotb Thank you for your kindness , I have been sent you an email included ssh details to the server, Much obliged.

uakfdotb commented 8 years ago

It looks like only binary subprotocol is being offered, and Lobster websockify module only supported base64 subprotocol. I have added support for binary subprotocol in 64b357c7e2321535ef0f2fb71fc0eacf934561cb