Bug 882110

Summary: Remote-viewer shows no error if connect to a spice port through vnc protocol
Product: Red Hat Enterprise Linux 6 Reporter: tingting zheng <tzheng>
Component: gtk-vncAssignee: Daniel Berrangé <berrange>
Status: CLOSED WONTFIX QA Contact: Desktop QE <desktop-qa-list>
Severity: low Docs Contact:
Priority: low    
Version: 6.4CC: cfergeau, cwei, dblechte, fidencio, jjongsma, marcandre.lureau, mjenner, mzhan, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 921330 (view as bug list) Environment:
Last Closed: 2017-02-08 14:43:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description tingting zheng 2012-11-30 06:50:22 UTC
Description of problem:
Remote-viewer shows no error if connect to a spice port through vnc protocol

Version-Release number of selected component (if applicable):
virt-viewer-0.5.2-16.el6.x86_64
libvirt-0.10.2-10.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Prepare a spice guest,set it port as 5900.
# virsh dumpxml test
    <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>


2. Use remote-viewer vnc instead spice to connect the guest,the window just pop out without error showed.
# remote-viewer vnc://localhost:5900 --debug
connect : Connection refused
** (remote-viewer:14182): DEBUG: Insert window 0 0x13f5890
** (remote-viewer:14182): DEBUG: fullscreen display 0: 0
** (remote-viewer:14182): DEBUG: fullscreen display 0: 0
** (remote-viewer:14182): DEBUG: Opening display to vnc://localhost:5900
** (remote-viewer:14182): DEBUG: Guest vnc://localhost:5900 has a vnc display
** (remote-viewer:14182): DEBUG: After open connection callback fd=-1
** (remote-viewer:14182): DEBUG: Opening connection to display at vnc://localhost:5900
** (remote-viewer:14182): DEBUG: notebook show status 0x13f60a0
** (remote-viewer:14182): DEBUG: notebook show status 0x13f60a0
** (remote-viewer:14182): DEBUG: notebook show display 0x13f60a0
** (remote-viewer:14182): DEBUG: Display size request 100x100 (desktop 100x100)
** (remote-viewer:14182): DEBUG: Allocated 400x375
** (remote-viewer:14182): DEBUG: Child allocate 375x375
** (remote-viewer:14182): DEBUG: Display size request 50x50 (desktop 100x100)
** (remote-viewer:14182): DEBUG: Allocated 400x375
** (remote-viewer:14182): DEBUG: Child allocate 375x375
** (remote-viewer:14182): DEBUG: Window closed
** (remote-viewer:14182): DEBUG: close vnc=0x13de760
** (remote-viewer:14182): DEBUG: Disconnected
** (remote-viewer:14182): DEBUG: close vnc=0x138b880
** (remote-viewer:14182): DEBUG: notebook show status 0x13f60a0
** (remote-viewer:14182): DEBUG: Guest vnc://localhost:5900 display has disconnected, shutting down
** (remote-viewer:14182): DEBUG: Disposing window 0x13f5890

** (remote-viewer:14182): DEBUG: Set connect info: (null),(null),(null),-1,(null),(null),(null),0

3.If use remote-viewer vnc to connect a guest with port which doesn't exist even for spice,there is error:
eg:
# remote-viewer vnc://localhost:5909 
Window pop out,and error shows as:Unable to connect to the graphic server vnc://localhost:5909


Actual results:
As step2 shows.

Expected results:
There is error messages shows:Unable to connect to the graphic server vnc://localhost:5900

Additional info: 
1.Remote-viewer shows error if connect to a vnc port through spice protocol,error showed as:Unable to connect to the graphic server spice://$ip:$port

Comment 1 Jonathon Jongsma 2013-11-18 21:35:31 UTC
It appears that this is caused by the fact that upon connecting to the server port, the vnc client tries to read 12 bytes from the server to determine the vnc server version (see vnc_connection_initialize()).  The spice server never sends anything, because it's waiting for the client to send a link message.  So remote-viewer sits there waiting forever.  Perhaps there should be a timeout for the initial connection, after which point we give up and indicate an error.

Comment 3 Fabiano FidĂȘncio 2014-09-16 14:08:24 UTC
As pointed by Jonathon, the gtk-vnc waits for the 12 bytes from the server to determine the server version.
Looking deeply in the code we can see that vnc_connection_read_wire() tries to connect to the socket but receives no data ("Error receiving data: Resource temporarily unavailable") what will cause a call to g_io_wait() and then coroutine_yield() where gtk-vnc waits forever.

I don't see it as a remote-viewer bug, maybe a gtk-vnc bug, but most likely not a bug, at least for me.

I'm reassigning  it to gtk-vnc for now, then the maintainer can decide if it can be considered as a bug or not.

Comment 4 Daniel Berrangé 2017-02-08 14:43:14 UTC
While we have come up with a workaround to avoid this problem, it involves changes to both the spice server and gtk-vnc. This is a low impact bug so not worth the effort of trying to co-ordinate backports for both components in RHEL-6. The fixes will be applied to RHEL-7 only.