Basically the test seems to be working (ie. 500 expected and received),
but handling the 500 error kills apache (seems to be a simple dereference
of a null pointer; probably returned from a call of strerror(500)).

Note that on Solaris strerror(500) returns 0x0.  On Linux, it returns
"Unknown error 500".

This is Solaris 2.6, gcc 2.95.2, Apache 2.0.50, mod_perl 1.99_16

 Output from TEST:

> $ t/TEST -no-httpd -verbose t/filter/in_error.t
[warning] Skipping 'set unlimited ulimit for coredumps', since we are
running as a non-root user on Solaris
[warning] skipping httpd configuration
t/filter/in_error....1..1
# Running under perl version 5.008004 for solaris
# Current time local: Thu Sep  9 10:36:14 2004
# Current time GMT:   Thu Sep  9 09:36:14 2004
# Using Test.pm version 1.25
# Using Apache/Test.pm version 1.14
# testing : an error in a filter should cause 500
# expected: 500
# received: 500
ok 1
ok

 From GDB (full stack trace):

[Thu Sep 09 10:40:38 2004] [info] 26 Apache:: modules loaded
[Thu Sep 09 10:40:38 2004] [info] 7 APR:: modules loaded
[Thu Sep 09 10:40:38 2004] [info] base server + 20 vhosts ready to run
tests

Program received signal SIGSEGV, Segmentation fault.
apr_cpystrn (dst=0xefffef58 "ï~ôÌ", src=0x0, dst_size=4026527831)
    at apr_cpystrn.c:57
57              if (!(*d = *src)) {
(gdb) where
#0  apr_cpystrn (dst=0xefffef58 "ï~ôÌ", src=0x0, dst_size=4026527831)
    at apr_cpystrn.c:57
#1  0xef654ea8 in stuffbuffer (buf=0xefffef58 "ï~ôÌ", bufsize=256, s=0x0)
    at errorcodes.c:34
#2  0xef655360 in native_strerror (statcode=500, buf=0xefffef58 "ï~ôÌ",
    bufsize=256) at errorcodes.c:375
#3  0xef65539c in apr_strerror (statcode=500, buf=0xefffef58 "ï~ôÌ",
    bufsize=256) at errorcodes.c:384
#4  0xef347ab4 in modperl_error_strerror ()
   from /u/hughesc/apache2/mod_perl-1.99_16/src/modules/perl/mod_perl.so
#5  0xee3810dc in XS_APR__Error_strerror ()
   from
/u/hughesc/apache2/mod_perl-1.99_16/blib/arch/auto/APR/Error/Error.so
#6  0xef20d9f4 in Perl_pp_entersub ()
   from
/usr/local/pkgs/ActivePerl-5.8.4.810/lib/5.8.4/sun4-solaris-thread-multi/CORE/libperl.so
#7  0xef2055c0 in Perl_runops_standard ()
   from
/usr/local/pkgs/ActivePerl-5.8.4.810/lib/5.8.4/sun4-solaris-thread-multi/CORE/libperl.so
#8  0xef1b2fb8 in Perl_amagic_call ()
   from
/usr/local/pkgs/ActivePerl-5.8.4.810/lib/5.8.4/sun4-solaris-thread-multi/CORE/libperl.so
#9  0xef213634 in Perl_sv_2bool ()
   from
/usr/local/pkgs/ActivePerl-5.8.4.810/lib/5.8.4/sun4-solaris-thread-multi/CORE/libperl.so
#10 0xef334664 in modperl_callback ()
   from /u/hughesc/apache2/mod_perl-1.99_16/src/modules/perl/mod_perl.so
#11 0xef334ac0 in modperl_callback_run_handlers ()
   from /u/hughesc/apache2/mod_perl-1.99_16/src/modules/perl/mod_perl.so
#12 0xef334be8 in modperl_callback_per_dir ()
   from /u/hughesc/apache2/mod_perl-1.99_16/src/modules/perl/mod_perl.so
#13 0xef32f58c in modperl_response_handler_run ()
   from /u/hughesc/apache2/mod_perl-1.99_16/src/modules/perl/mod_perl.so
#14 0xef32f66c in modperl_response_handler ()
   from /u/hughesc/apache2/mod_perl-1.99_16/src/modules/perl/mod_perl.so
#15 0x0004b9d4 in ap_run_handler (r=0x1384e40) at config.c:151
#16 0x0004bfd0 in ap_invoke_handler (r=0x1384e40) at config.c:358
#17 0x00039018 in ap_process_request (r=0x1384e40) at http_request.c:246
#18 0x00034218 in ap_process_http_connection (c=0x1380ee8) at
http_core.c:250
#19 0x00057220 in ap_run_process_connection (c=0x1380ee8) at
connection.c:42
#20 0x00057530 in ap_process_connection (c=0x1380ee8, csd=0x1380e30)
    at connection.c:175
#21 0x0004a258 in child_main (child_num_arg=587776) at prefork.c:609
#22 0x0004a320 in make_child (s=0x9ea08, slot=0) at prefork.c:649
#23 0x0004a454 in startup_children (number_to_start=2) at prefork.c:721
#24 0x0004a858 in ap_mpm_run (_pconf=0x2, plog=0xd43b8, s=0x9ea08)
    at prefork.c:940
#25 0x00050d88 in main (argc=10, argv=0xeffffae4) at main.c:617

So I read this as:

apr_strerror(500, [...])
calling
native_strerror(500, [...])
calling
stuffbuffer([...], strerror(500)) which is stuffbuffer([...], 0x0)
calling
apr_cpystrn([...], NULL, [...])
which tries to dereference it.  Doh

 I made a very quick hack fix to srclib/arp/misc/unix/errorcodes.c:

***************
*** 372,378 ****
      sprintf(err, "Native Error #%d", statcode);
      return stuffbuffer(buf, bufsize, err);
  #else
!     return stuffbuffer(buf, bufsize, strerror(statcode));
  #endif
  }
  #endif
--- 372,379 ----
      sprintf(err, "Native Error #%d", statcode);
      return stuffbuffer(buf, bufsize, err);
  #else
!     char *str = strerror(statcode);
!     return stuffbuffer(buf, bufsize, str?str:"Unknown error");
  #endif
  }
  #endif

 Which seems to fix it.

 So this is a problem with Apache rather than mod_perl?

ta,

Chris




--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to