Received: (at submit) by bugs.x2go.org; 9 Jul 2014 21:57:25 +0000
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
	ymir.das-netzwerkteam.de
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,HTML_MESSAGE
	autolearn=ham version=3.3.2
Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170])
	by ymir.das-netzwerkteam.de (Postfix) with ESMTPS id C88F65DB24
	for <submit@bugs.x2go.org>; Wed,  9 Jul 2014 23:57:21 +0200 (CEST)
Received: by mail-vc0-f170.google.com with SMTP id hy10so8781315vcb.29
        for <submit@bugs.x2go.org>; Wed, 09 Jul 2014 14:57:19 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:content-type:subject:message-id:date:to
         :mime-version;
        bh=CM1H/QdzwcUufuX1NKoMpVTRxgTLuMJUDOxmuRSr3RY=;
        b=byRf5Xk95MYrgKSv9BDaSKuQkSSpdDmuvYhYybUo9RKT8hurMXCS80jCG+Jhn3+c/d
         dqCZfmQtE2XJeCaiKfaLNrOwVvD16ps5+Q3STVMawdqrp4inB/BALK5WLQH4stLomAfb
         vb0ItYDJbsHkcpyY/03LIkBWqeh/Nd5ULPM/GCgFnEkXA/ShNylq3TaOKkd0uNSF4OEl
         VOBJuPkr3SPAT6I/aF6x9UpytIj/jdrLR3zcW7wud3fIG8soTL33qEjJUpg5quc6ANk5
         6aypsDfOu9TBja3MxiZSAmqhhWi4vxhntJoJYEoaD/bzavCr3oVhfFouS8GLFILwHF1n
         0zUA==
X-Gm-Message-State: ALoCoQnsvHoGPqMWwLSkeiZfeJ+G7u7XJ0vSmCVNjSgku6QcFv9ImY0BlMfVegN4CGUerOOzQb9u
X-Received: by 10.52.157.164 with SMTP id wn4mr397250vdb.81.1404943039657;
        Wed, 09 Jul 2014 14:57:19 -0700 (PDT)
Received: from [10.59.27.114] (97-64-141-154.client.mchsi.com. [97.64.141.154])
        by mx.google.com with ESMTPSA id p55sm76621896yhh.34.2014.07.09.14.57.18
        for <submit@bugs.x2go.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Wed, 09 Jul 2014 14:57:18 -0700 (PDT)
From: "Gregory R. Warnes" <greg@warnes.net>
Content-Type: multipart/alternative; boundary="Apple-Mail=_F905D346-9CCF-4E4B-8DE8-A0CDAB407632"
Subject: x2golistdesktops locks up if xwininfo does
Message-Id: <DF03EDF1-51CB-4E07-B316-4411BC0D97CB@warnes.net>
Date: Wed, 9 Jul 2014 17:57:09 -0400
To: submit@bugs.x2go.org
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
X-Mailer: Apple Mail (2.1878.6)


--Apple-Mail=_F905D346-9CCF-4E4B-8DE8-A0CDAB407632
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=windows-1252

Package:  x2godesktopsharing
Version: 3.1.1.1-0~131~ubuntu12


Hi,  my server had a =91weird=92 file in /tmp/.X11-unix/ for which xwininfo=
 would never return, locking up x2golistdesktops.

The solution is to provide a timeout for the shell call to xwininfo.  This =
can be accomplished either using the shell command =91timeout=92 or the Per=
l IPC::Run module (as described in the first response to http://stackoverfl=
ow.com/questions/16918005/time-out-when-using-system-cmd-in-perl).

For my purpose, I=92ve used the shell timeout command. Patch below.

-Greg


--- /usr/bin/x2golistdesktops	2014-04-03 10:14:22.000000000 -0500
+++ x2golistdesktops	2014-07-09 16:43:54.000000000 -0500
@@ -43,7 +43,7 @@
 	$serv=3Dhostname;
 }

-my $rsess=3D`x2golistsessions x2goserver |grep _stR`;
+my $rsess=3D`timeout 1s x2golistsessions x2goserver |grep _stR`;
 my @rsess=3Dsplit("\n","$rsess");
 my @rdisplays;
 for (my $i=3D0;$i<@rsess;$i++)
@@ -67,7 +67,7 @@
 	$checkdisp=3D"${checkdisp}I";
 	if (!( $rdisp =3D~ m/$checkdisp/ ))
 	{
-		my $inf=3D`xwininfo -root -display $display 2> /dev/null`;
+		my $inf=3D`timeout 1s xwininfo -root -display $display 2> /dev/null`;
 		if ( $inf=3D~ m/geometry/)
 		{
 			print "$uname\@$display\n";
@@ -88,4 +88,4 @@
 }

 # closing syslog
-closelog;
\ No newline at end of file
+closelog;
w



--Apple-Mail=_F905D346-9CCF-4E4B-8DE8-A0CDAB407632
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=windows-1252

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><div>Package: &nbsp;<s=
pan style=3D"background-color: rgb(255, 255, 255); color: rgb(102, 102, 102=
); font-family: Consolas, 'Andale Mono WT', 'Andale Mono', 'Bitstream Vera =
Sans Mono', 'Nimbus Mono L', Monaco, 'Courier New', monospace; line-height:=
 19.600000381469727px;">x2godesktopsharing</span></div><div>Version:&nbsp;3=
.1.1.1-0~131~ubuntu12</div><div><br></div><div><br></div>Hi, &nbsp;my serve=
r had a =91weird=92 file in&nbsp;/tmp/.X11-unix/ for which xwininfo would n=
ever return, locking up x2golistdesktops.<div><br></div><div>The solution i=
s to provide a timeout for the shell call to xwininfo. &nbsp;This can be ac=
complished either using the shell command =91timeout=92 or the Perl&nbsp;<s=
pan style=3D"background-color: rgb(238, 238, 238);">IPC</span><span class=
=3D"sh_symbol">::</span><span style=3D"background-color: rgb(238, 238, 238)=
;">Run</span>&nbsp;module (as described in the first response to&nbsp;<a hr=
ef=3D"http://stackoverflow.com/questions/16918005/time-out-when-using-syste=
m-cmd-in-perl">http://stackoverflow.com/questions/16918005/time-out-when-us=
ing-system-cmd-in-perl</a>).</div><div><br></div><div>For my purpose, I=92v=
e used the shell timeout command. Patch below.</div><div><br></div><div>-Gr=
eg</div><div><br></div><div><br></div><div><div>--- /usr/bin/x2golistdeskto=
ps<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>2014-04-=
03 10:14:22.000000000 -0500</div><div>+++ x2golistdesktops<span class=3D"Ap=
ple-tab-span" style=3D"white-space:pre">	</span>2014-07-09 16:43:54.0000000=
00 -0500</div><div>@@ -43,7 +43,7 @@</div><div>&nbsp;<span class=3D"Apple-t=
ab-span" style=3D"white-space:pre">	</span>$serv=3Dhostname;</div><div>&nbs=
p;}</div><div><br></div><div>-my $rsess=3D`x2golistsessions x2goserver |gre=
p _stR`;</div><div>+my $rsess=3D`timeout 1s x2golistsessions x2goserver |gr=
ep _stR`;</div><div>&nbsp;my @rsess=3Dsplit("\n","$rsess");</div><div>&nbsp=
;my @rdisplays;</div><div>&nbsp;for (my $i=3D0;$i&lt;@rsess;$i++)</div><div=
>@@ -67,7 +67,7 @@</div><div>&nbsp;<span class=3D"Apple-tab-span" style=3D"=
white-space:pre">	</span>$checkdisp=3D"${checkdisp}I";</div><div>&nbsp;<spa=
n class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>if (!( $rdisp =
=3D~ m/$checkdisp/ ))</div><div>&nbsp;<span class=3D"Apple-tab-span" style=
=3D"white-space:pre">	</span>{</div><div>-<span class=3D"Apple-tab-span" st=
yle=3D"white-space:pre">		</span>my $inf=3D`xwininfo -root -display $displa=
y 2&gt; /dev/null`;</div><div>+<span class=3D"Apple-tab-span" style=3D"whit=
e-space:pre">		</span>my $inf=3D`timeout 1s xwininfo -root -display $displa=
y 2&gt; /dev/null`;</div><div>&nbsp;<span class=3D"Apple-tab-span" style=3D=
"white-space:pre">		</span>if ( $inf=3D~ m/geometry/)</div><div>&nbsp;<span=
 class=3D"Apple-tab-span" style=3D"white-space:pre">		</span>{</div><div>&n=
bsp;<span class=3D"Apple-tab-span" style=3D"white-space:pre">			</span>prin=
t "$uname\@$display\n";</div><div>@@ -88,4 +88,4 @@</div><div>&nbsp;}</div>=
<div><br></div><div>&nbsp;# closing syslog</div><div>-closelog;</div><div>\=
 No newline at end of file</div><div>+closelog;</div><div>w</div></div><div=
><br></div><div><br></div></body></html>=

--Apple-Mail=_F905D346-9CCF-4E4B-8DE8-A0CDAB407632--
