On Thu, Nov 27, 2003 at 05:12:10PM -0800, Stas Bekman wrote:
httpd -DONE_PROCESS -DNO_DETACH
Oh, *ick*; it's a Heisenbug.
This time it didn't dump core -- it did what it was doing originally:
In which case you can run the server normally and still get the core file, but in addition to the ulimit command you need to make the directory where httpd resides writable by the user the server is running under. The whole path to that directory needs to +x to that user.
The easiest way for you to test whether you can get the core dumped is this. let's say your httpd resides in /appl/Apache/bin/httpd, so we do:
% su % cd /appl/Apache/bin/ % perl -MPOSIX -e 'my($uid, $gid) = (getpwnam(shift))[2..3]; \ POSIX::setuid($uid); POSIX::setgid($gid); \ print -r q{$dir} && -w _ && -x _ ? q{OK} : q{NOK};' \ nobody
If you get NOK that means that the core file won't be dumped. If OK, then it'll work. In fact you can just try to dump the core as that user in a similar way:
% su % cd /appl/Apache/bin/ % perl -MPOSIX -e 'my($uid, $gid) = (getpwnam(shift))[2..3]; \ POSIX::setuid($uid); POSIX::setgid($gid); \ CORE::dump;' \ nobody
If you get:
Abort
That means that the core wasn't dumped. If you get:
Abort (core dumped)
then you will find a "nice" core file in /appl/Apache/bin/
So let's say you don't get the core, what you do next is fixing the perms of the whole path leading to the location of httpd:
% su % cd /appl/Apache/bin/ % perl -e 'use File::Spec::Functions qw(splitdir); use Cwd; \ my($uid, $gid) = (getpwnam(shift))[2..3]; \ @dirs = splitdir(Cwd::cwd); shift @dirs; \ chown $uid, $gid, "." and chdir ".." for @dirs' \ nobody
(The above could be written in a simpler way, assuming that we are on Unix, but it's been a while since I stopped assuming things about platforms and try to write a portable code from the very beginning)
Now try to get the core file again. Remember that you just adjusted the whole path to be owned by that user ('nobody') in our example. You may want to go and restore the original ownership after you are done with the core.
Notice that all these scripts are run as root, and we assume that the server is running under the user nobody.
Again, notice that the core file could be something like core.16291, where the number after . is the pid of the process that dumped that core.
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html