solaris wierdness: daemons grabbing ports of killed processes...

From: Mark (mark@solinus.com)
Date: Tue Jul 08 2003 - 15:16:01 EDT


Hey all --

I'm consistently coming across some wierdness with solaris 8 (2/02) on V100's.
The problem is this:

There is a daemon, listening on a named pipe, that when the appropriate data
is sent over, it will stop apache, and start it back up. This is done to
facilitate updates to modules to apache and whatnot.

There is also a program, kicked off by cron, or by command line, which will
connect to the above named pipe, and send the appropriate data over the pipe
to rekick apache (Things are done this way to allow updating of apache via web
pages, including restarting itself).

The curious thing is this: about half of the time, when the daemon tries to
stop/restart apache, after it gets stopped, cron steps in and grabs port 80.
This in turn causes the apache start process to fail, since port 80 is already
bound.

Even more curiousness: output from lsof (version 4.67) shows that cron is
listening on the port, and an nmap from outside the box shows that port 80 is
open. Now, trussing cron, and connecting to port 80 from an outside source
does nothing (cron is sleeping on a read), and you can type all day on the
connection to port 80, and nothing will happen.

lsof output:
------------
> lsof -i 4TCP:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
cron 24693 root 18u IPv4 0x3000386a928 0t0 TCP mfdev:80 (LISTEN)
cron 24693 root 19u IPv4 0x300038606d0 0t0 TCP console:80 (LISTEN)

But, if you stop/restart cron, port 80 is freed up, and apache can once again
start.

This behaviour has also been witnessed when the client program is run from the
command line, in which case it is sshd that grabs the port, and a stop/start
of sshd again cures that problem.

Has anyone ever come across this? If it's a case of the parent process
assuming control of the port of the child process after it dies, how is it
that cron (and/or ssh) is assuming the control? wouldn't it then fall to the
daemon listening on the named pipe, since it is the one that is
stopping/restarting apache?

Thanks in adavance for any and all help... this one is causing a real
headache.

-- 
Mark Maurer       
mark@solinus.com  
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers


This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:26:43 EDT