On Tuesday 24 May 2005 09:39, [EMAIL PROTECTED] wrote: > I claim, the "main process " detection does never work and does not make > sense. Why? Not even when the apache is started on boot through init, the > PPID will be 1, but some shell / rc pid. You can only find the PPID in the > PID file that apache writes. But still: this should never be the case - > right ?
Normally Apache forks on startup to get rid of its parent. So the init-process (1) inherits the orphan. Then Apache spawns its workers that are direct children of the master Apache. Hence the test is in principle right. [EMAIL PROTECTED]:~> ps -lC httpd F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 5 S 0 7155 1 0 76 0 - 2756 - ? 00:00:00 httpd 5 S 30 7158 7155 0 80 0 - 2774 322495 ? 00:00:00 httpd 5 S 30 7159 7155 0 80 0 - 2774 semtim ? 00:00:00 httpd PID 7155 is the main apache. It's PPID is 1. But there is a problem with Perls getppid() implementation. Modern Perls issue the syscall only once and cache the result. Maybe you somehow hit that. Normally the cache is invalidated when Perl forks, but Apache does its own fork. Thus maybe the cache remains. I'd try to replace getppid with syscall( &SYS_getppid ) and see if it changes anything. Torsten
pgpqireN6jUu4.pgp
Description: PGP signature