You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Ken Simpson <ks...@larch.mailchannels.com> on 2004/08/26 00:28:43 UTC

[mp2] Protocol handler tests fail in 1.99_16 with Apache 2.0.50

1. Problem Description:

  When I run make test, the protocol handler tests fail -- all other
  tests up to that point do not fail.

  After digging in a bit, it seems that what is happening is that the
  input bucket brigade is always empty (i.e. is_empty() always returns
  true). This same problem occurs with 1.99_15.

  In the error log, I get the following error:
 
  [Wed Aug 25 15:09:48 2004] [error] APR::Socket::recv: (35) Resource \
    temporarily unavailable at
  /export/src/mod_perl-1.99_16/t/protocol/TestProtocol/echo_block.pm line 34

  Any ideas as to why this might be happening?

  BTW -- a potential strangeness is that I have two Perls on
  this box: 5.8.4 and 5.8.2; 5.8.4's @INC includes the 5.8.2 include
  paths (see below) -- could that be causing the problem?
  
  Here's a transcript of the test failures:
   
   ... (from make test TEST_VERBOSE=1)
   # expected: mod_perl
   # received:
   not ok 2
   # Failed test 2 in t/filter/both_str_con_add.t at line 22
   #  t/filter/both_str_con_add.t line 22 is:     ok t_cmp($reply, $str);
   # expected: 2.0
   # received:
   not ok 3
   # Failed test 3 in t/filter/both_str_con_add.t at line 22 fail #2
   # expected: rules
   # received:
   not ok 4
   # Failed test 4 in t/filter/both_str_con_add.t at line 22 fail #3
   FAILED tests 2-4
           Failed 3/4 tests, 25.00% okay
   ...

   # expected: hello
   # received:
   not ok 2
   # Failed test 2 in t/protocol/echo_block.t at line 19
   #  t/protocol/echo_block.t line 19 is:     ok t_cmp($reply, $_);
   # expected: world
   # received:
   not ok 3
   # Failed test 3 in t/protocol/echo_block.t at line 19 fail #2
   ...

   # expected: HELLO
   # received:
   not ok 2
   # Failed test 2 in t/protocol/echo_filter.t at line 19
   #  t/protocol/echo_filter.t line 19 is:     ok t_cmp($reply, uc($_));
   # expected: WORLD
   # received:
   not ok 3
   # Failed test 3 in t/protocol/echo_filter.t at line 19 fail #2

2. Used Components and their Configuration:

*** mod_perl version 1.9916

*** using /export/src/mod_perl-1.99_16/lib/Apache/BuildConfig.pm

*** Makefile.PL options:
  MP_APR_LIB     => aprext
  MP_APXS        => /usr/local/apache2.0.50-modperl1.99_16/bin/apxs
  MP_COMPAT_1X   => 1
  MP_GENERATE_XS => 1
  MP_LIBNAME     => mod_perl
  MP_USE_DSO     => 1
  MP_USE_STATIC  => 1


*** /usr/local/apache2.0.50-modperl1.99_16/bin/httpd -V
Server version: Apache/2.0.50
Server built:   Aug 23 2004 20:08:21
Server's Module Magic Number: 20020903:8
Architecture:   32-bit
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D HTTPD_ROOT="/usr/local/apache2.0.50-modperl1.99_16"
 -D SUEXEC_BIN="/usr/local/apache2.0.50-modperl1.99_16/bin/suexec"
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"


*** (apr|apu)-config linking info

 -L/usr/local/apache2.0.50-modperl1.99_16/lib -lapr-0 -lm -lresolv  -lpthread
 -L/usr/local/apache2.0.50-modperl1.99_16/lib -laprutil-0 -ldb -lexpat



*** /usr/local/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
  Platform:
    osname=openbsd, osvers=3.4, archname=OpenBSD.i386-openbsd
    uname='openbsd malleus.mailchannels.com 3.4 malleus#0 i386 '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='2.95.3 20010125 (prerelease, propolice)', gccosandvers='openbsd3.4'
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags ='-Wl,-E  -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib
    libs=-ldb -lm -lutil -lc
    perllibs=-lm -lutil -lc
    libc=/usr/lib/libc.so.30.1, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-DPIC -fPIC ', lddlflags='-shared -fPIC  -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: USE_LARGE_FILES
  Built under openbsd
  Compiled at May  6 2004 19:19:56
  %ENV:
    PERL_LWP_USE_HTTP_10="1"
  @INC:
    /usr/local/lib/perl5/5.8.4/OpenBSD.i386-openbsd
    /usr/local/lib/perl5/5.8.4
    /usr/local/lib/perl5/site_perl/5.8.4/OpenBSD.i386-openbsd
    /usr/local/lib/perl5/site_perl/5.8.4
    /usr/local/lib/perl5/site_perl/5.8.2/OpenBSD.i386-openbsd
    /usr/local/lib/perl5/site_perl/5.8.2
    /usr/local/lib/perl5/site_perl
    .

*** Packages of interest status:

Apache::Request: -
CGI            : 3.04
LWP            : 5.76
mod_perl       : 1.9916


3. This is the core dump trace: (if you get a core dump):

  [CORE TRACE COMES HERE]

This report was generated by t/REPORT on Wed Aug 25 22:14:03 2004 GMT.

-- 
MailChannels: Control Your Email
http://www.mailchannels.com

Ken Simpson, CEO
+1-604-729-1741

-- 
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


Re: [mp2] Protocol handler tests fail in 1.99_16 with Apache 2.0.50

Posted by Ken Simpson <ks...@larch.mailchannels.com>.
> Oh, so may be it was always broken. Didn't you say that the problem was 
> introduced in Apache 2.0.50?

It seemed that way, but I think that it actually died in 0.49. I'm
trying with 0.48.

TTUL
Ken

-- 
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


Re: [mp2] Protocol handler tests fail in 1.99_16 with Apache 2.0.50

Posted by Stas Bekman <st...@stason.org>.
Ken Simpson wrote:

>>>Great. I'll look at the patch. There are no relevant diffs between
>>>0.49 and 0.50 in the apr/network_io/unix/sockopt.c so the damage must
>>>have occurred somewhere else.
>>
>>Please double check that (may be the httpd-dev archives), I could be
>>wrong.
> 
> 
> That patch only affects the HTTP protocol handler
> (http://www.apache.org/dist/httpd/patches/apply_to_2.0.49/CAN-2004-0493.patch)
> so I don't think it could be responsible for this behaviour. Also, I
> retested with 0.49 and the same problem is happening so.. who knows.

Oh, so may be it was always broken. Didn't you say that the problem was 
introduced in Apache 2.0.50?

>>Yup, I'll be on the move starting tomorrow, so I'm not sure when I'll be 
>>able to work on that. Ideally that should happen after 2.0 release, so we 
>>don't get new TODO things on the way and first glean out the existing 
>>ones. But feel free to work on those and we will help with any questions 
>>that you may have (but better post them to the dev list, as they are more 
>>technical than this list should care about).
> 
> 
> Okay -- sorry I didn't know there was a dev list. I'll subscribe to
> it.

http://perl.apache.org/maillist/dev.html

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
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


Re: [mp2] Protocol handler tests fail in 1.99_16 with Apache 2.0.50

Posted by Ken Simpson <ks...@larch.mailchannels.com>.
> >I'm tracing through the Apache code to see what's actually happening.
> 
> Ouch.
> 
> Notice that apr-1.0 can be released any moment now. So please post a 
> notice to the apr-dev list if you find what the problem is.

Okay -- I'll do that.

> >Great. I'll look at the patch. There are no relevant diffs between
> >0.49 and 0.50 in the apr/network_io/unix/sockopt.c so the damage must
> >have occurred somewhere else.
> 
> Please double check that (may be the httpd-dev archives), I could be
> wrong.

That patch only affects the HTTP protocol handler
(http://www.apache.org/dist/httpd/patches/apply_to_2.0.49/CAN-2004-0493.patch)
so I don't think it could be responsible for this behaviour. Also, I
retested with 0.49 and the same problem is happening so.. who knows.

> Yup, I'll be on the move starting tomorrow, so I'm not sure when I'll be 
> able to work on that. Ideally that should happen after 2.0 release, so we 
> don't get new TODO things on the way and first glean out the existing 
> ones. But feel free to work on those and we will help with any questions 
> that you may have (but better post them to the dev list, as they are more 
> technical than this list should care about).

Okay -- sorry I didn't know there was a dev list. I'll subscribe to
it.

TTUL
Ken


-- 
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


Re: [mp2] Protocol handler tests fail in 1.99_16 with Apache 2.0.50

Posted by Stas Bekman <st...@stason.org>.
Ken Simpson wrote:
>>>I have tried this and it makes no difference -- it looks like non
>>>blocking mode is simply not being set. 
>>
>>And this verification code doesn't fail?
>>
>>        # test that we really *are* in the blocking mode
>>        !$socket->opt_get(APR::SO_NONBLOCK)
>>            or die "failed to set blocking mode";
> 
> 
> That's correct. Deep inside Apache, it is keeping track of the
> blocking modes as if they've been set but .. what it returns
> apparently does not reflect reality.
> 
> I'm tracing through the Apache code to see what's actually happening.

Ouch.

Notice that apr-1.0 can be released any moment now. So please post a 
notice to the apr-dev list if you find what the problem is.

>>I think it's this change that introduced this "feature":
>>
>>  *) SECURITY: CAN-2004-0493 (cve.mitre.org)
>>     Close a denial of service vulnerability identified by Georgi
>>     Guninski which could lead to memory exhaustion with certain
>>     input data.  [Jeff Trawick]
>>
>>So you don't need to check all the differences. I think apr was affected 
>>as well.
> 
> 
> Great. I'll look at the patch. There are no relevant diffs between
> 0.49 and 0.50 in the apr/network_io/unix/sockopt.c so the damage must
> have occurred somewhere else.

Please double check that (may be the httpd-dev archives), I could be wrong.

One thing is sure is that Linux is not affected. I have discoved this 
problem through other people running on other platforms (solaris and bsd 
mainly).

>>In fact APR is broken as it ignores the APR::BLOCK_READ flag in filters. 
>>But nobody at httpd-dev/apr-dev seems to even care :( So filter writers 
>>need to manually set the socket to the blocking mode, which sucks :(
> 
> 
> I agree. Of course, the deepest irony here is that what we actually
> should be doing for our application is writing APR::Poll support into
> mod_perl because Net::Server::Mail expects a non-blocking handle..

Yup, I'll be on the move starting tomorrow, so I'm not sure when I'll be 
able to work on that. Ideally that should happen after 2.0 release, so we 
don't get new TODO things on the way and first glean out the existing 
ones. But feel free to work on those and we will help with any questions 
that you may have (but better post them to the dev list, as they are more 
technical than this list should care about).


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
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


Re: [mp2] Protocol handler tests fail in 1.99_16 with Apache 2.0.50

Posted by Ken Simpson <ks...@larch.mailchannels.com>.
> >I have tried this and it makes no difference -- it looks like non
> >blocking mode is simply not being set. 
> 
> And this verification code doesn't fail?
> 
>         # test that we really *are* in the blocking mode
>         !$socket->opt_get(APR::SO_NONBLOCK)
>             or die "failed to set blocking mode";

That's correct. Deep inside Apache, it is keeping track of the
blocking modes as if they've been set but .. what it returns
apparently does not reflect reality.

I'm tracing through the Apache code to see what's actually happening.

> I think it's this change that introduced this "feature":
> 
>   *) SECURITY: CAN-2004-0493 (cve.mitre.org)
>      Close a denial of service vulnerability identified by Georgi
>      Guninski which could lead to memory exhaustion with certain
>      input data.  [Jeff Trawick]
> 
> So you don't need to check all the differences. I think apr was affected 
> as well.

Great. I'll look at the patch. There are no relevant diffs between
0.49 and 0.50 in the apr/network_io/unix/sockopt.c so the damage must
have occurred somewhere else.

> In fact APR is broken as it ignores the APR::BLOCK_READ flag in filters. 
> But nobody at httpd-dev/apr-dev seems to even care :( So filter writers 
> need to manually set the socket to the blocking mode, which sucks :(

I agree. Of course, the deepest irony here is that what we actually
should be doing for our application is writing APR::Poll support into
mod_perl because Net::Server::Mail expects a non-blocking handle..

Thanks for the help.

TTUL
Ken

-- 
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


Re: [mp2] Protocol handler tests fail in 1.99_16 with Apache 2.0.50

Posted by Stas Bekman <st...@stason.org>.
Ken Simpson wrote:
>>Hmm, may be it reports blocking when it's not. What if you replace the 
>>whole blocking testing/setting conditional block, with just unconditional:
>>
>>  $socket->opt_set(APR::SO_NONBLOCK => 0);
> 
> 
> I have tried this and it makes no difference -- it looks like non
> blocking mode is simply not being set. 

And this verification code doesn't fail?

         # test that we really *are* in the blocking mode
         !$socket->opt_get(APR::SO_NONBLOCK)
             or die "failed to set blocking mode";


> I'm going to examine the diffs
> between Apache 2.0.49 and .50; this code worked properly on .49. I
> have a suspicion that something they did broke the OpenBSD build.

I think it's this change that introduced this "feature":

   *) SECURITY: CAN-2004-0493 (cve.mitre.org)
      Close a denial of service vulnerability identified by Georgi
      Guninski which could lead to memory exhaustion with certain
      input data.  [Jeff Trawick]

So you don't need to check all the differences. I think apr was affected 
as well.

In fact APR is broken as it ignores the APR::BLOCK_READ flag in filters. 
But nobody at httpd-dev/apr-dev seems to even care :( So filter writers 
need to manually set the socket to the blocking mode, which sucks :(


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
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


Re: [mp2] Protocol handler tests fail in 1.99_16 with Apache 2.0.50

Posted by Ken Simpson <ks...@larch.mailchannels.com>.
> Hmm, may be it reports blocking when it's not. What if you replace the 
> whole blocking testing/setting conditional block, with just unconditional:
> 
>   $socket->opt_set(APR::SO_NONBLOCK => 0);

I have tried this and it makes no difference -- it looks like non
blocking mode is simply not being set. I'm going to examine the diffs
between Apache 2.0.49 and .50; this code worked properly on .49. I
have a suspicion that something they did broke the OpenBSD build.

Regards,
Ken


-- 
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


Re: [mp2] Protocol handler tests fail in 1.99_16 with Apache 2.0.50

Posted by Stas Bekman <st...@stason.org>.
Ken Simpson wrote:
> 1. Problem Description:
> 
>   When I run make test, the protocol handler tests fail -- all other
>   tests up to that point do not fail.
> 
>   After digging in a bit, it seems that what is happening is that the
>   input bucket brigade is always empty (i.e. is_empty() always returns
>   true). This same problem occurs with 1.99_15.
> 
>   In the error log, I get the following error:
>  
>   [Wed Aug 25 15:09:48 2004] [error] APR::Socket::recv: (35) Resource \
>     temporarily unavailable at
>   /export/src/mod_perl-1.99_16/t/protocol/TestProtocol/echo_block.pm line 34
> 
>   Any ideas as to why this might be happening?

Hmm, may be it reports blocking when it's not. What if you replace the 
whole blocking testing/setting conditional block, with just unconditional:

   $socket->opt_set(APR::SO_NONBLOCK => 0);

>   BTW -- a potential strangeness is that I have two Perls on
>   this box: 5.8.4 and 5.8.2; 5.8.4's @INC includes the 5.8.2 include
>   paths (see below) -- could that be causing the problem?

Probably not, the test suite shouldn't get affected by preinstalled older 
mod_perl versions.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
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