[FreeNX-kNX] Sanity check...

Fabian Franz FabianFranz at gmx.de
Sat Apr 23 15:41:40 UTC 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Samstag, 23. April 2005 17:32 schrieb Ed Warnicke:
> On Saturday 23 April 2005 07:03 am, Fabian Franz wrote:
> > exec 3>&1 # save stdout
> > exec 1>&2 # put all stdout to stderr instead
> > netcat >&3 # connect with old stdout
> >
> > to prevent the effects that _any_ message goes to stdout after the bye
> > command.
> >
> > But this needs testing and evaulation.
>
> That seems like a good first approach ;)

Ok, I'll add a FR to do that.

> I dug into this more after I sent the email.
> As it turns out there is a race condition between
> nc and the starting of the nxagent by nxnode.

Good catch! This should solve many more problems.

> If nxagent isn't ready to accept the connection
> from nc when the nc call is made, then nc quietly
> exits and you fail in negotiating link parameters.
> This failure is partially masked by the 'NX>'
> error.  I debuged this with something like

Great.

>
> log "netcat started"
> netcat [...]
> log "netcat finished with exit code $?"
>
> which showed an exit code of 1.  After that
> line you saw the 'NX> [...]" lines associated with
> nxagent listening for connections.

Ok.

>
> Trying
>
> sleep 3; netcat [...]
>
> fixed the problem (which for some reason was
> reliably occuring for me last night).  

Thats great :-). I mean: How could you have debugged it else ;-)?

> So I am pretty
> sure there is a race condition between calling
> nc in nxserver and the nxagent started by nxnode
> listening.  

> I don't think a sleep is the right solution
> though.  Thoughts?

Yes:

TRY=3
while [ $TRY -gt 0 ]
do
	netcat && break
	sleep 1
	let TRY=$TRY-1
done
if [ $TRY -eq 0 ]
then
	echo "NX> 550 Error: nxagent failed to start after three tries." 1>&2
fi

cu

Fabian

PS: Please test and then I can apply it to CVS.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFCamy2I0lSH7CXz7MRAlshAJwN2v5rG+rKDw6QcrwGyzMiWutR6gCZAQoj
za0XgzMVbGvqYrajJOucbRw=
=UYO5
-----END PGP SIGNATURE-----




More information about the FreeNX-kNX mailing list