After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 690449 - tunneling VNC through SSH is broken
tunneling VNC through SSH is broken
Status: RESOLVED FIXED
Product: vinagre
Classification: Applications
Component: VNC
3.6.x
Other Linux
: Normal major
: ---
Assigned To: vinagre-maint
vinagre-maint
Depends on:
Blocks:
 
 
Reported: 2012-12-18 20:25 UTC by Sébastien Villemot
Modified: 2013-01-06 11:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use GPollableInputStream when checking for SSH errors, in order to prevent a blocking read (3.20 KB, patch)
2012-12-23 16:19 UTC, Sébastien Villemot
committed Details | Review

Description Sébastien Villemot 2012-12-18 20:25:15 UTC
On my Debian Wheezy amd64 system, VNC tunnelling through SSH does not work. When I launch the connection, Vinagre waits for 15 seconds then fails with "An error occurred. Connection to host $HOST failed". I can deterministically reproduce this with Vinagre 3.4.2 (from Debian) and 3.6.2 (locally compiled).

This is not a duplicate of #644432, because the failure is deterministic and does not involve SIGHUP.

I isolated the cause of the problem: in vinagre-ssh.c, function look_for_stderr_errors(), the call to g_data_input_stream_read_line() is blocking. It waits until the SSH command line exits after the 15 seconds delay, and the tunnel is therefore not established.

This read call should be non-blocking: in function vinagre_ssh_connect(), before calling look_for_stderr_errors(), there is a call to fcntl() with O_NONBLOCK flag. But for some reason this seems to be ineffective. I guess this has to do with some Glib internals when creating the GInputStreams. Note that I could reproduce the bug against both Glib 2.32 and 2.34.
Comment 1 Sébastien Villemot 2012-12-23 16:19:48 UTC
Created attachment 232150 [details] [review]
Use GPollableInputStream when checking for SSH errors, in order to prevent a blocking read
Comment 2 Sébastien Villemot 2012-12-23 16:21:24 UTC
I attached a patch that fixes the issue for me. It uses GPollableInputStream to determine if input is available on the SSH error stream (only on Un*x systems, I left the current behavior unchanged on Windows since GPollableInputStream is not implemented there).

As a side effect, the patch fixes a minor memory leak in vinagre-ssh.c:look_for_stderr_errors() where the "line" variable was not correctly freed in all cases.
Comment 3 David King 2013-01-06 11:34:29 UTC
Comment on attachment 232150 [details] [review]
Use GPollableInputStream when checking for SSH errors, in order to prevent a blocking read

Thanks for the patch. I pushed it to master and gnome-3-6 branches as commits 920f41e874368eb46f52bfe8d9755cde5b11faa6 and 5f0688183974e3d5d055b8d136c1ac7ee6e3041c.