This happened to me once (actually many times, but I figured out my
approach on the first time), I could only figure out one way to
handle it, and its been the one thing I hate about perl ever since
(as I know there HAS to be a bettter way )
What I do:
package MyApp::Debug;
use constant DEBUG_FUNCTION_NAME => 1;
sub print_function_name {
# derive function name by looping caller, print to STDERR
}
sub print_caller_stack {
# print the entire caller stack. useful for odd debugging, print to
STDERR
}
package MyApp::JustAboutEverything;
sub render_page {
my ( $self )= @_;
MyApp::Debug::DEBUG_FUNCTION_NAME &&
MyApp::Debug::print_function_name();
}
sub another_function {
my ( $self )= @_;
MyApp::Debug::DEBUG_FUNCTION_NAME && MyApp::Debug::
print_function_name ();
}
its messy, because I need to put that damn DEBUG_FUNCTION_NAME in
every sub I want to act like this. if i were a better perl
programmer, I'd have take the time to figure out a better way to
overload how perl calls functions.
in any event, since DEBUG_FUNCTION_NAME is based a constant, the
lines are nicely optimized away in production code ( assuming you
turn that option off ). i think it ends upon average to making my
dev server run about 5% larger in memory use and about 5% slower in
exeuction too. but i just set DEBUG_FUNCTION_NAME to 0, and its gone.
my guess is that your error is causing an issue in some XS code or in
perl/apache iteself - so you're not going to get any error caught.
in the past, i've gotten those segfaults from:
reading a bad cookie ( libapreq2 .05, i think ) ( c error )
handling an upload via apache request2 ( c error )
having a bad tied session under Apache2::Session ( xs error )
some random apache2 error.
i don't know if any of that helps. good luck!
On May 23, 2007, at 3:49 PM, Tyler Bird wrote:
Ok,
I have a system I converted from cgi to mod_perl.
We recently upgraded to mod_perl 2.0 and apache 2.2 on RHL5
I am having a problem. When I refresh a certain page 5 times or
about ( it's completely random )
The page renders fine, but in my logs I see that an apache child
died because of a segmentation fault I believe
here is the error or I guess notice message.
[notice] child pid 25946 exit signal Segmentation fault (11) # ? do
I have to worry about this notice ? what we are building will be a
live system.
My question is why is it doing this? I have but try{} catch
clauses on the whole script and it has yielded me no errors
that I have detected on this before like somewhere deep in the code
I am missing a require().
Any ideas on how I could better trap a segmentation fault besides
using perl's try{} catch{} like catching it's signal?