bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disowned process hangs terminal during logout/exit


From: Jesse Molina
Subject: Re: Disowned process hangs terminal during logout/exit
Date: Wed, 5 Dec 2007 16:44:51 -0700
User-agent: Mutt/1.5.17 (2007-11-01)

Hmmm...  

I'm using 'lsof -d 0-255' and I don't see any FDs related to the subshell, the 
tail, or the NETCAT processes.

I don't know what this shell is waiting on, though I'm sure it's one of these 
processes.  As soon as I kill them off, the shell releases.



I want to go back to the fact that I can do these three lines;

(sleep 30) &
disown $!
logout

And, on two systems (RHEL and Ubuntu) the terminal hangs until sleep is done or 
killed.  On the other two (Debian and OS X), the logout is immediate and sleep 
continues to run.  What's the difference in the behavior?  The $BASH_VERSION on 
the Ubuntu and Debian hosts are the same -- 3.1.17(1)-release.



On Wed, Dec 05, 2007 at 04:17:25PM -0700, Jesse Molina wrote:
> 
> Thank you for the explanation about the descriptors.  That's very insightful.
> 
> However, your suggested fix did not help the situation.  I think that was 
> even something that I had tried the day before.
> 
> Netcat has strange issues about wanting stdin -- it won't run backgrounded 
> without being fed tail -f /dev/null.  I wonder if it isn't the problem here.  
> I had discounted it since I redirected both stdin and stdout to the logfile.
> 
> I'll use lsof and see if I can find anything interesting.
> 
> Other suggestions are welcome.
> 
> 
> 
> 
> On Wed, Dec 05, 2007 at 03:49:09PM -0500, Paul Jarc wrote:
> > Jesse Molina <jesse@opendreams.net> wrote:
> > > Basically, on the two troubled systems, my interactive shell will
> > > hang after I've disowned a process.  On one other system, everything
> > > works as expected.  I expect that a disowned process should not hang
> > > logout -- disowned means disowned.
> > 
> > The terminal will hang around as long as any process has an open
> > descriptor connected to it.  "disown" does not (and cannot) disconnect
> > an already-running process's file descriptors from the terminal.  It
> > only affects the relationship between the process and bash, not
> > between the process and the terminal.
> > 
> > > It seems like it's hanging on stdout since redirecting to /dev/null fixes 
> > > the problem.
> > 
> > You could have the same problem with stdin/stderr.
> > 
> > > Here is the actual line where I am having trouble.  I can't redirect 
> > > tail's output in this case.  It seems like tail is the offender.
> > >
> > > (tail -f < /dev/null | $NETCAT -l -p $LISTENPORT >> $LOGFILE 2>&1) &
> > 
> > tail's stderr would still be connected to the terminal in that case.
> > See if this works:
> > (tail -f < /dev/null 2> /dev/null | $NETCAT -l -p $LISTENPORT >> $LOGFILE 
> > 2>&1) &
> > 
> > 
> > paul
> 
> -- 
> # Jesse Molina
> # Mail = jesse@opendreams.net
> # Page = page-jesse@opendreams.net
> # Cell = 1.602.323.7608
> # Web  = http://www.opendreams.net/jesse/
>  
>  

-- 
# Jesse Molina
# Mail = jesse@opendreams.net
# Page = page-jesse@opendreams.net
# Cell = 1.602.323.7608
# Web  = http://www.opendreams.net/jesse/
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]