SUMMARY: read() on closed pipe doesn't return EOF

From: Urie, Todd <TUrie_at_trueposition.com>
Date: Tue Sep 17 2002 - 08:29:51 EDT
First, many thanks to the only respondent, Casper Dik.  As soon as I did
what he suggested, I was able to determine the exact cause of the problem.


Second, a brief description of the problem:

When attempting to start Apache from the /etc/init.d/apache startup script,
the apache startup script would hang at the following line:

status=`${APACHE_HOME}/bin/apachectl $1 2>&1`

Using 'truss' I had determined that the script was attempting a read on what
should have been a closed pipe that was opened when the apache script forked
for the `apachectl` command.  Since the process that was forked for the
`apachectl` command was shown as 'defunct', I couldn't figure out why the
read on what was supposed to be a closed pipe did not return EOF.

Thirdly, the solution:

Per Casper's recommendation, I ran the following:

pfiles apache_PID

which yielded the following:
[ Unimportant stuff cut out ]

   3: S_IFIFO mode:0000 dev:228,0 ino:144 uid:0 gid:1 size:0
      O_RDWR

indicating that someone somewhere still had the file descriptor open.
Executing, again per Casper's recommendation, the following:

find /proc -type p -inum 144

yielded:

/proc/487/fd/1
/proc/487/fd/2
/proc/482/fd/3

which shows that pid 487 still has the pipe open, which is why the read by
pid 482 didn't return EOF.

Further investigation showed that the offending pid was a log rotate script
added to the Apache startup process by our development team in the last
build, which explains why this problem just started to appear.

Finally, many thanks to Casper for his help and providing a little
education.  I learned several valuable lessons as a result of this.

Todd Urie
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Tue Sep 17 08:33:28 2002

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:55 EST