Session not completely terminated after "End" (patch)

Bug #1321177 reported by Bodo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
FreeNX Server
New
Undecided
Unassigned

Bug Description

I'm using freenx-server 0.7.3.zgit.120322.977c28d-0~ppa11 and NoMachine's NX Client for Windows 3.5.0-9.

When I terminate sesions by using the "X" button of the window and selecting "End" or when the session is disconnected due to loss of the network connection I get hanging sessions. Sometimes it is no longer possible to connect with NX Client, somtimes I get a list of sessions but can neither resume nor terminate them.
When I call "sudo /etc/init.d/freenx-server stop" the sessions get terminated and I can connect again.

In /var/log/nxserver.log I found this:

NX> 105 server_nxnode_echo: NX> 1006 Session status: running
bye
Bye
NX> 999 Bye
nxnode_reader: NX> 1009 Session status: terminating
NX> 1009 Session status: terminating
session_status BC732222297E97AE333484D56BBDBBCF Terminating
server_nxnode_echo: NX> 1009 Session status: terminating
Info: Closing connection to slave with pid 29383.
nxnode_reader: 1001 Bye.
1001 Bye.
nxnode_reader: expect: spawn id exp7 not open
nxnode_reader: while executing
nxnode_reader: "expect "NX> 1001 Bye.""
nxnode_reader: (file "/usr/lib/nx/nxnode-login" line 105)
expect: spawn id exp7 not open
while executing
"expect "NX> 1001 Bye.""
(file "/usr/lib/nx/nxnode-login" line 105)

/usr/lib/nx/nxnode-login wants to find "NX> 1001 Bye." but it gets "1001 Bye." only.

In /usr/lib/nx/nxnode the message is sent with
echo "$DELIM 1001 Bye."
and DELIM is set to
DELIM="NX>"
And it might also be
[ -n "$2" ] && DELIM="NX-$2>"
but I don't know under which circumstances $2 is passed to nxnode.

But there is a case when DELIM is set to an empty string or something else.

                if [ "$CMD" = "--startsession" -o "$CMD" = "--resumesession" ]
                then
                        export SLAVE_PID="$$"
                        ( echo "$CMDLINE" | "$0" "$CMD"; kill "$SLAVE_PID"; ) &
                        NODE_SESSION="$!"
                else
                        DELIM=""
                        [ -n "$NODE_SESSION" ] && DELIM="$NODE_SESSION->$CMD"
                        ( echo "$CMDLINE" | "$0" "$CMD" "$DELIM"; ) &
                fi

When this case is executed, the exit message is sent without the prefix "NX>"

I replaced DELIM with DELIM2 in the "else" branch which seems to fix the problem. (see patch)
With this fix the log is OK:

NX> 105 server_nxnode_echo: NX> 1006 Session status: running
bye
Bye
NX> 999 Bye
nxnode_reader: NX> 1009 Session status: terminating
NX> 1009 Session status: terminating
session_status 00AB6151468BEAD38C18A6A2C523C082 Terminating
server_nxnode_echo: NX> 1009 Session status: terminating
Info: Closing connection to slave with pid 32307.
nxnode_reader: NX> 1001 Bye.
NX> 1001 Bye.
server_nxnode_echo: NX> 1001 Bye.
Info: Closing connection to slave with pid 32307.

General remarks:

I don't know the specification of the protocol, but I think the system is a bit fragile. When comparing to FTP protocol or similar, I think it would be better to check the message number only, not the message text, e.g. "expect "NX> 1001 "".
If it is really possible for DELIM to be "NX-$2>" a pattern should be used, e.g. "expect "NX*> 1001 "".

Bodo

Revision history for this message
Bodo (bodo-bodo-m) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.