Ldm sometimes hangs at logout

Bug #375278 reported by Alkis Georgopoulos
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ldm (Ubuntu)
Fix Released
Low
Scott Balneaves

Bug Description

Binary package hint: ldm

Hi,

My TCs had a problem of ldm hanging at logout, waiting for an already-finished process (the ssh connection) to finish.

The problem was in sshutils.c:
> ldm_wait(pid);
> read(ldm.sshfd, buf, sizeof buf); /* clear any exit message so ssh can exit cleanly */
> ldm_wait(ldm.sshpid);

where in my slow terminals half of the time "sshpid" finished before "pid", so ldm_wait got mixed up and waited 2 times for "sshpid".

To solve this, in ldm.c I had to change
- res = waitid (P_ALL, 0, &info, WEXITED | WSTOPPED);
+ res = waitid (P_PID, pid, &info, WEXITED | WSTOPPED);
so that ldm_wait only waits for the SPECIFIED child, and not for ANY child.

I also had to do the following changes in sshutils.c:
+ fcntl(ldm.sshfd, F_SETFL, O_NONBLOCK);
to make the following clean-up call non-blocking:
read(ldm.sshfd, buf, sizeof buf);

Even though I didn't experience any problems with it, I also thought it would be nice to change the "read" above to a "while" so that it flushes sshfd even for size > sizeof buf.

A last note, in ldm_wait I don't think the "while" is needed anymore, because it waits for the specific child it was called for. I tried it without the "while" and it works fine, but I'm not sending it to keep the proposed changes to a minimum. Of course I can send it if you like.

Kind regards,
Alkis Georgopoulos

alkisg@alkis:~$ LANG=en dpkg -l ltsp* && sudo chroot /opt/ltsp/i386 dpkg -l ltsp*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-=================================-=================================-==================================================================================
ii ltsp-server 5.1.65-0ubuntu2 Basic LTSP server environment
ii ltsp-server-standalone 5.1.65-0ubuntu2 Complete LTSP server environment
un ltsp-utils <none> (no description available)
ii ltspfs 0.5.10-0ubuntu1 Fuse based remote filesystem for LTSP thin clients
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Όνομα Έκδοση Περιγραφή
+++-=================================-=================================-==================================================================================
ii ltsp-client 5.1.65-0ubuntu2 LTSP client environment
ii ltsp-client-core 5.1.65-0ubuntu2 LTSP client environment
ii ltspfsd 0.5.10-0ubuntu1 Fuse based remote filesystem daemon for LTSP thin clients

Revision history for this message
Alkis Georgopoulos (alkisg) wrote :
Ryan Niebur (ryan52)
Changed in ldm (Ubuntu):
assignee: nobody → Ryan Niebur (ryan52)
importance: Undecided → Low
status: New → In Progress
Revision history for this message
Ryan Niebur (ryan52) wrote :

crap, sorry for forgetting to look at this. if somebody else wants to, go ahead.

Changed in ldm (Ubuntu):
assignee: Ryan Niebur (ryan52) → Scott Balneaves (sbalneav)
Changed in ldm (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Stéphane Graber (stgraber) wrote :

Fixed in latest ldm for Karmic.

Changed in ldm (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Steve Cayford (cayfo001) wrote :

Is there a fix or work-around available for Jaunty?

Revision history for this message
Alkis Georgopoulos (alkisg) wrote :

You may use stgraber's ppa if you want, there's a backported jaunty version of ltsp there: https://launchpad.net/~stgraber/+archive/ppa

Revision history for this message
Steve Cayford (cayfo001) wrote : Re: [Bug 375278] Re: Ldm sometimes hangs at logout

Thanks. I'll try that.

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.