[one-users] noVNC error: "Server disconnected" [socket.error: [Errno 98] Address already in use] ? (Users Digest, Vol 50, Issue 10)

Jhon Masschelein jhon.masschelein at sara.nl
Tue May 1 23:57:38 PDT 2012


Hi,

Sorry for the thread necro here, but I needed a bit of time to get this 
done.

We've actually been having the same problem since we installed the 3.x 
Opennebula.

We've now applied a little patch that gives the user a "reset" button 
for the vnc connection: http://tinyurl.com/7xyf6ho

Maybe this can work for you too.

To make this work, you need to add a "post" path in 
/usr/lib/one/sunstone/sunstone-server.rb:

##############################################################################
# FORCE KILL the VNC Session of a target VM
##############################################################################
post '/vm/resetvnc/:vncport' do |vncport|
     cmd = "kill -9 `ps -ef | grep -v grep | grep 'python 
/usr/share/one/noVNC/utils/wsproxy.py " + vncport + "' | awk '{ print $2}'`"
     `#{cmd}`
end

I put it just above the "MONITOR" path.

As you can see, this will actually perform a kill on the proxy process. 
since the vncport variable is added to the grep search string, and port 
numbers are never re-used, this is safe.

Sadly I did not find an easy way to add a check that verifies that the 
person clicking the link has manage rights on the VM. Since the only 
thing it does is killl the proxy, there is not much risk involved. 
Still, it would be nice to have a check.


The second part is of course to add the button to the VM plugin page in 
/usr/lib/one/sunstone/public/js/plugins/vms-tab.js

Look for the line

<td class="value_td"><span class="vnc">'+vncIcon(vm_info)+'</span></td>\

And change it as follows (careful with the word-wrap):

<td class="value_td"><span class="vnc">'+vncIcon(vm_info)+'</span>\
	<button type="button" onclick=\'$.ajax({ type: "POST", url: 
"/vm/resetvnc/'+(vm_info["TEMPLATE"]["GRAPHICS"]["PORT"]*1+29876)+'"});return 
false;\' >Reset VNC</button></td>\


The thing to note here is the number 29876 which is added to the PORT 
parameter. This is the default value, but you may have changed it.

It is the vnc_proxy_base_port value in the /etc/one/sunstone-server.conf 
file. If you changed it there, you will need to use your value here.

The sunstone server will need to be restarted to make the path work.

This is not a perfect solution, but it has been in use for a week or so 
here and it has proven to be useful.

Wkr,

Jhon


On 04/10/2012 12:29 PM, Rolandas Naujikas wrote:
> On 2012-04-05 11:24, Hector Sanjuan wrote:
>> Hello, I don't get to reproduce this. I close and reopen repeted times the
>> VNC window and it works well.
>
> Try to close web browser tab or do refresh of it with noVNC canvas open.
> The only solution in such cases - kill hang wsproxy process.
>
> Rolandas
>
> P.S. I think there should be some mechanism to shutdown wsproxy from
> server side or reuse it for later sessions, or kill it before creating
> new one.
>
>> When you close the vnc window, you should be seeing a line like and the
>> stopvnc action pop up message:
>>
>> Thu Apr 05 10:15:21 2012 [I]: 127.0.0.1 - - [05/Apr/2012 10:15:21] "POST
>> /vm/12/stopvnc HT
>> TP/1.1" 200 - 0.0610
>>
>> Could you check that this request happens and that it acknowledged with
>> 200?
>>
>> Thanks,
>>
>> Hec
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org

-- 
Jhon Masschelein
Senior Systeemprogrammeur
SARA - HPCV

Science Park 140
1098 XG Amsterdam
T +31 (0)20 592 8099
F +31 (0)20 668 3167
M +31 (0)6 4748 9328
E jhon.masschelein at sara.nl
http://www.sara.nl



More information about the Users mailing list