<br><tt><font size=2>Some people are reporting having to make several attempts</font></tt>
<br><tt><font size=2>to login to FreeNX after a server re-boot, before
the first</font></tt>
<br><tt><font size=2>successful login takes place.</font></tt>
<br>
<br><tt><font size=2>After this, things are reported as being fine, until
the next</font></tt>
<br><tt><font size=2>OS restart.</font></tt>
<br><tt><font size=2>( I'm not sure that this is the full picture, as I'll
explain )</font></tt>
<br>
<br>
<br><tt><font size=2>I've had a run through the code, and watched some
startups</font></tt>
<br><tt><font size=2>Here's what I see happening.</font></tt>
<br>
<br>
<br><tt><font size=2>For a new session, FreeNX runs the nxagent in the
</font></tt>
<br><tt><font size=2>background from an instance of nxnode </font></tt>
<br><tt><font size=2>( node_start_agent & )</font></tt>
<br><tt><font size=2> </font></tt>
<br><tt><font size=2> . . then immediately . .</font></tt>
<br>
<br><tt><font size=2>runs what it calls "The Application", also
in the background,</font></tt>
<br><tt><font size=2>( node_start_applications & )</font></tt>
<br>
<br><tt><font size=2>The Application can be "startkde" ( or whatever
) for a</font></tt>
<br><tt><font size=2>desktop session, or a user application eg. ooo-writer</font></tt>
<br><tt><font size=2>for a rootless session.</font></tt>
<br>
<br><tt><font size=2>Before starting kde, the script runs xrdb -merge which</font></tt>
<br><tt><font size=2>is normally launched as part of the X client, startx
etc. </font></tt>
<br>
<br>
<br><tt><font size=2>This is causing a problem, because the xrdb and the</font></tt>
<br><tt><font size=2>application, kde ( for example ) are starting before</font></tt>
<br><tt><font size=2>the display port is open, failing, and terminating
the</font></tt>
<br><tt><font size=2>whole FreeNx session, including the agent.</font></tt>
<br>
<br><tt><font size=2>The reason for this failure is that the script takes
</font></tt>
<br><tt><font size=2>some time to launch nxagent, and then nxagent takes</font></tt>
<br><tt><font size=2>some time to load its shared libraries, the first
time</font></tt>
<br><tt><font size=2>it is run.</font></tt>
<br>
<br><tt><font size=2>These libraries stay in memory, unless thay are flushed</font></tt>
<br><tt><font size=2>out, so subsequent logins are quicker and don't fail.</font></tt>
<br>
<br>
<br><tt><font size=2>This is why I say I don't think that the re-boot senario</font></tt>
<br><tt><font size=2>is the whole picture.</font></tt>
<br>
<br><tt><font size=2>In fact, I expect that a machine also used for other
tasks</font></tt>
<br><tt><font size=2>will, if there is no FreeNX activity, revert to the
</font></tt>
<br><tt><font size=2>"multiple login attempts required" state,
due to other</font></tt>
<br><tt><font size=2>jobs causing unused shared libraries to be flushed
out</font></tt>
<br><tt><font size=2>of memory.</font></tt>
<br>
<br><tt><font size=2>No one has reported this however.</font></tt>
<br>
<br><tt><font size=2>I also expect that xrdb fails quite often.</font></tt>
<br>
<br><tt><font size=2>It is subsequently run if needed by the kde session
after</font></tt>
<br><tt><font size=2>it is started, and it is possible that things have
only been</font></tt>
<br><tt><font size=2>working up to now because of the delay caused by </font></tt>
<br><tt><font size=2>the launching of xrdb.</font></tt>
<br>
<br><tt><font size=2>Note.</font></tt>
<br>
<br><tt><font size=2>The reason it takes several runs to complete is that
although</font></tt>
<br><tt><font size=2>the nxagent is terminated after part loading its libraries,
any</font></tt>
<br><tt><font size=2>libraries which have been loaded are available for
the next</font></tt>
<br><tt><font size=2>attempt, which can therefore get a little nearer to
completion.</font></tt>
<br>
<br><tt><font size=2>After a few tries, they are all in memory, and no
more</font></tt>
<br><tt><font size=2>issues.</font></tt>
<br>
<br>
<br><tt><font size=2>The fix is very simple.</font></tt>
<br>
<br><tt><font size=2>The rule is very golden.</font></tt>
<br>
<br><tt><font size=2>When backgrounding a script to launch something upon
which</font></tt>
<br><tt><font size=2>something else depends, bear in mind that the the
script launch</font></tt>
<br><tt><font size=2>will return straight away, then continue with the
load. </font></tt>
<br>
<br><tt><font size=2>To emulate synchronous launching, a delay must be
introduced.</font></tt>
<br>
<br>
<br>
<br><tt><font size=2>Patch for nxnode 0.7.3</font></tt>
<br>
<br><tt><font size=2>Watch out for line wraps messing up the diff.</font></tt>
<br>
<br><tt><font size=2>It will probably be easier to look for xrdb -merge
in an editor</font></tt>
<br><tt><font size=2>and add the sleep.</font></tt>
<br>
<br><tt><font size=2>--- nxnode.orig 2008-11-28 12:18:13.000000000 +0000</font></tt>
<br><tt><font size=2>+++ nxnode.mod 2010-04-07 14:44:18.000000000
+0100</font></tt>
<br><tt><font size=2>@@ -328,6 +328,9 @@</font></tt>
<br><tt><font size=2>
NODE_WM_PID=$!</font></tt>
<br><tt><font size=2> fi</font></tt>
<br>
<br><tt><font size=2>+ # Patch - delay to allow nxagent
to complete lauching. ccb 20100407</font></tt>
<br><tt><font size=2>+ sleep 4</font></tt>
<br><tt><font size=2>+</font></tt>
<br><tt><font size=2> echo "Xft.dpi: 96"
| DISPLAY=:$display xrdb -merge >>"$USER_FAKE_HOME/.nx/C-$sess_id/session"
2>&1</font></tt>
<br><tt><font size=2> [ -d /etc/X11/Xresources
] && xrdb -display :$display -merge /etc/X11/Xresources/* >>"$USER_FAKE_HOME/.nx/C-$sess_id/session"
2>&1</font></tt>
<br>
<br>
<br>
<br><tt><font size=2>If this works for you, please let us know so the next
</font></tt>
<br><tt><font size=2>people with this problem have some idea if it is a
fix</font></tt>
<br><tt><font size=2>for them or not !!</font></tt>
<br>
<br><tt><font size=2>If it doesn't work I'm sure you will say something!!</font></tt>
<br>
<br>
<br><tt><font size=2>cb</font></tt>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>