[ramble] Re: hang on exit - bug or no bug?

Phil Howard phil-openssh-unix-dev at ipal.net
Sat Oct 6 03:32:25 EST 2001

Pekka Savola wrote:

> On Thu, 4 Oct 2001, Schieber, Dustin wrote:
> > I've also seen this problem with various 3rd party software packages.
> > Apparently this is a widespread problem with the open fds.
> It's probably a bug in the software -- e.g. fds not being closed when
> forking.  This can have grave security considerations also.

However, I see this problem a lot.  Many daemon programs don't
close their std* file descriptors once started up.  I can tell
because I get error messages from said daemons later from the
session where I restarted that service.  Apparently whoever
writes some of these assumes it gets started _only_ at boot
time and would never be restarted manually by the sysadmin from
other than the system console.  My workaround is to use screen.
This is because I _do_ want to see any messages that come out at
the time of starting up in case it isn't starting properly.


I'm currently writing a couple of new servers for some projects
and part of the core server design is that the first process to
be started forks off the actual daemon as a grandchild, and exits
as soon as the actual daemon reports a successful start or dies.
This first process will not pass std* descriptors to the daemon,
but instead will pass pipes to it as std* descriptors, and will
then read from the pipes and write to the original descriptors
until it sees EOF.

Some services don't do a very good job of making sure they go
into the background quickly, while still checking for errors
and returning an error status if the common errors prevent it
from operating.  BIND sometimes hangs for a while.  Sendmail
was particularly bad about this (way way too many DNS queries
before starting up).  Even Apache has problems with the default
or common configurations (I've worked around it).  Sometimes
I wonder if those programmers have ever been a system admin on
a network with 99.999% 24/7/365 uptime requirements for hundreds
of servers, or if their sysadmin experience is keeping their own
file server in their office running during most office hours.


| Phil Howard - KA9WGN |   Dallas   | http://linuxhomepage.com/ |
| phil-nospam at ipal.net | Texas, USA | http://phil.ipal.org/     |

More information about the openssh-unix-dev mailing list