1=head1 NAME 2 3Debugging mod_perl Perl Internals 4 5=head1 Description 6 7This document explains how to debug Perl code under mod_perl. 8 9Most of the L<mod_perl 1.0 debug 10documentation|docs::1.0::guide::debug> applies to mod_perl 2.0: 11 12 13 14 15 16=head2 Detecting Hanging Processes 17 18See L<Hanging Processes: Detection and 19Diagnostics|docs::1.0::guide::debug/Hanging_Processes__Detection_and_Diagnostics> 20for the explanation, but under mp2 to use signals to detect where the 21process is spinning, you can't use C<$SIG{USR2}>, you have to use 22POSIX signals. i.e. the code becomes: 23 24 use Carp (); 25 use POSIX qw(SIGUSR2); 26 my $mask = POSIX::SigSet->new( SIGUSR2 ); 27 my $action = POSIX::SigAction->new(\&tell_where_spinning, $mask); 28 my $oldaction = POSIX::SigAction->new(); 29 POSIX::sigaction(SIGUSR2, $action, $oldaction ); 30 31 sub tell_where_spinning { 32 Carp::confess("caught SIGUSR2!"); 33 }; 34 35and then: 36 37 % kill USR2 <pid_of_the_spinning_process> 38 39and watch for the trace in F<error_log>. 40 41 42 43 44 45=head1 Maintainers 46 47Maintainer is the person(s) you should contact with updates, 48corrections and patches. 49 50=over 51 52=item * 53 54Stas Bekman [http://stason.org/] 55 56=back 57 58=head1 Authors 59 60=over 61 62=item * 63 64Stas Bekman [http://stason.org/] 65 66=back 67 68Only the major authors are listed above. For contributors see the 69Changes file. 70 71=cut 72