X2Go Bug report logs - #806
connection fails with error binding localhost:XXX when creating new session

version graph

Package: x2goclient; Maintainer for x2goclient is X2Go Developers <x2go-dev@lists.x2go.org>; Source for x2goclient is src:x2goclient.

Reported by: Jason Alavaliant <alavaliant@ra09.com>

Date: Sat, 7 Mar 2015 02:30:02 UTC

Severity: important

Found in version

Full log

Message #5 received at submit@bugs.x2go.org (full text, mbox, reply):

Received: (at submit) by bugs.x2go.org; 7 Mar 2015 02:29:06 +0000
From alavaliant@ra09.com  Sat Mar  7 03:29:04 2015
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=ham
Received: from thetower.ra09.com (ra09.com [])
	by ymir.das-netzwerkteam.de (Postfix) with ESMTPS id 3ACB95E156
	for <submit@bugs.x2go.org>; Sat,  7 Mar 2015 03:29:04 +0100 (CET)
Received: from localhost ([] helo=private.ra09.com)
	by thetower.ra09.com with esmtp (Exim 4.80)
	(envelope-from <alavaliant@ra09.com>)
	id 1YU4U7-0002jj-TB
	for submit@bugs.x2go.org; Sat, 07 Mar 2015 15:29:00 +1300
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
Content-Transfer-Encoding: 7bit
Date: Sat, 07 Mar 2015 15:28:59 +1300
From: Jason Alavaliant <alavaliant@ra09.com>
To: submit@bugs.x2go.org
Subject: connection fails with error binding localhost:XXX when creating new
Message-ID: <cd3e51f3aa4efef71477213e69028753@private.ra09.com>
X-Sender: alavaliant@ra09.com
User-Agent: Roundcube Webmail/1.0.5
Package: x2goclient
Severity: important

All clients trying to create a new sessions on my x2go broker setup 
started failing with the error message

Unable to create ssl tunnel:
Error binding localhost:XXX

and in each case the XXX was a port number lower than 1024

Digging through the client code and looking at the shared session 
database on the backend as far as I can tell the issue is;

1) the session database port numbers have reached values of 65000 and 
greater (for example on the last session I created the database gr_port 
was 65087)

2) the client gets given that data and adds 1000 to it 
(onmainwindows.cpp line "int iport=localGraphicPort.toInt() + 1000;")

3) the resulting port number is over the highest valid port number of 
65535 and hence later on when it is used the value overflows around to 
be port 552

4) ports under 1024 are reserved on Unix and can't be used by normal 
user processes and hence the error and the connection failing.

For now I've worked around the issue by patching the client 
onmainwindows.cpp section under the "int iport=localGraphicPort.toInt() 
+ 1000;" line to add to the various checks an extra check that sees in 
the value is over 65535 and if so to subtract 63382 which causes the 
port value to end up above the 1024 range.        I don't think this is 
a complete fix however since it only covers gr_port (which broke first 
since it gets 1000 added to it which doesn't seem to occur for 
sound_port and fs_port?) and I'm not sure if I what direction I should 
be looking at fixing this in order to make a patch that will be accepted 

I'm suspecting this might actually be considered an bug with the 
x2goserver database code (it shouldn't set port so high?)   so I'm 
hoping you can advise on where I should be concentrating on fixing the 
code.       I'm not sure if you'll think it should be patched both in 
the client and in the server code   or if it should only be checked for 
in the server code?


Send a report that this bug log contains spam.

X2Go Developers <owner@bugs.x2go.org>. Last modified: Sat Jun 3 15:21:02 2023; Machine Name: ymir.das-netzwerkteam.de

X2Go Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.