Author: stas
Date: Wed Dec  8 07:08:01 2004
New Revision: 111273

URL: http://svn.apache.org/viewcvs?view=rev&rev=111273
Log:
$bb->cleanup is no more segfaulting (was segfaulting due to a broken
prototype in APR, and consequently invalid XS glue code)

Modified:
   perl/modperl/trunk/Changes
   perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs2.pm
   perl/modperl/trunk/todo/release
   perl/modperl/trunk/xs/APR/Brigade/APR__Brigade.h
   perl/modperl/trunk/xs/maps/apr_functions.map
   perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm

Modified: perl/modperl/trunk/Changes
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?view=diff&rev=111273&p1=perl/modperl/trunk/Changes&r1=111272&p2=perl/modperl/trunk/Changes&r2=111273
==============================================================================
--- perl/modperl/trunk/Changes  (original)
+++ perl/modperl/trunk/Changes  Wed Dec  8 07:08:01 2004
@@ -12,6 +12,10 @@
 
 =item 1.99_18-dev
 
+$bb->cleanup is no more segfaulting (was segfaulting due to a broken
+prototype in APR, and consequently invalid XS glue code) [Randy Kobes,
+Stas]
+
 make sure that ABSPERLRUN and ABSPERLRUN are defined in
 src/modules/perl/Makefile (needed by win32 build) [Stas]
 

Modified: perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs2.pm
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs2.pm?view=diff&rev=111273&p1=perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs2.pm&r1=111272&p2=perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs2.pm&r2=111273
==============================================================================
--- perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs2.pm     (original)
+++ perl/modperl/trunk/t/protocol/TestProtocol/echo_bbs2.pm     Wed Dec  8 
07:08:01 2004
@@ -4,11 +4,6 @@
 # brigade for input and output, using flatten to slurp all the data in
 # the bucket brigade, and cleanup to get rid of the old buckets
 
-# XXX: ideally $bb->cleanup should be used here and no create/destroy
-# bb every time the loop is entered should be done. But it segfaults
-# on certain setups:
-# http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=108967266419527&w=2
-
 use strict;
 use warnings FATAL => 'all';
 
@@ -28,11 +23,11 @@
     # the socket to a blocking IO mode
     $c->client_socket->opt_set(APR::SO_NONBLOCK, 0);
 
+    my $bb_in  = APR::Brigade->new($c->pool, $c->bucket_alloc);
+    my $bb_out = APR::Brigade->new($c->pool, $c->bucket_alloc);
+
     my $last = 0;
     while (1) {
-        my $bb_in  = APR::Brigade->new($c->pool, $c->bucket_alloc);
-        my $bb_out = APR::Brigade->new($c->pool, $c->bucket_alloc);
-
         my $rc = $c->input_filters->get_brigade($bb_in,
                                                 Apache::MODE_GETLINE);
         last if $rc == APR::EOF;
@@ -48,10 +43,13 @@
 
         $c->output_filters->fflush($bb_out);
 
-        # XXX: add DESTROY and remove explicit calls
-        $bb_in->destroy;
-        $bb_out->destroy;
+        $bb_in->cleanup;
+        $bb_out->cleanup;
     }
+
+    # XXX: add DESTROY and remove explicit calls
+    $bb_in->destroy;
+    $bb_out->destroy;
 
     Apache::OK;
 }

Modified: perl/modperl/trunk/todo/release
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/todo/release?view=diff&rev=111273&p1=perl/modperl/trunk/todo/release&r1=111272&p2=perl/modperl/trunk/todo/release&r2=111273
==============================================================================
--- perl/modperl/trunk/todo/release     (original)
+++ perl/modperl/trunk/todo/release     Wed Dec  8 07:08:01 2004
@@ -26,7 +26,3 @@
   but that doesn't really solve the problem. So we aren't sure how to
   deal with that.
 
-* $bb->cleanup segfaults (originally in TestProtocol::echo_bbs2
-  http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=108967266419527&w=2
-  owner: gozer
-

Modified: perl/modperl/trunk/xs/APR/Brigade/APR__Brigade.h
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/APR/Brigade/APR__Brigade.h?view=diff&rev=111273&p1=perl/modperl/trunk/xs/APR/Brigade/APR__Brigade.h&r1=111272&p2=perl/modperl/trunk/xs/APR/Brigade/APR__Brigade.h&r2=111273
==============================================================================
--- perl/modperl/trunk/xs/APR/Brigade/APR__Brigade.h    (original)
+++ perl/modperl/trunk/xs/APR/Brigade/APR__Brigade.h    Wed Dec  8 07:08:01 2004
@@ -14,6 +14,14 @@
  */
 
 static MP_INLINE
+void mpxs_APR__Brigade_cleanup(apr_bucket_brigade *brigade)
+{
+    /* apr has a broken prototype (passing 'void *' instead of
+     * 'apr_bucket_brigade *', so use a wrapper here */
+    apr_brigade_cleanup(brigade);
+}
+
+static MP_INLINE
 apr_bucket_brigade *mpxs_apr_brigade_create(pTHX_ SV *CLASS,
                                             apr_pool_t *p,
                                             apr_bucket_alloc_t *ba)

Modified: perl/modperl/trunk/xs/maps/apr_functions.map
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/maps/apr_functions.map?view=diff&rev=111273&p1=perl/modperl/trunk/xs/maps/apr_functions.map&r1=111272&p2=perl/modperl/trunk/xs/maps/apr_functions.map&r2=111273
==============================================================================
--- perl/modperl/trunk/xs/maps/apr_functions.map        (original)
+++ perl/modperl/trunk/xs/maps/apr_functions.map        Wed Dec  8 07:08:01 2004
@@ -94,7 +94,8 @@
 !apr_brigade_write
 !apr_brigade_puts
 -apr_brigade_putc
- apr_brigade_cleanup
+~ apr_brigade_cleanup
+ mpxs_APR__Brigade_cleanup
 ~apr_brigade_flatten
 ~apr_brigade_pflatten
 ?apr_brigade_split_line

Modified: perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm?view=diff&rev=111273&p1=perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm&r1=111272&p2=perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm&r2=111273
==============================================================================
--- perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm       
(original)
+++ perl/modperl/trunk/xs/tables/current/ModPerl/FunctionTable.pm       Wed Dec 
 8 07:08:01 2004
@@ -2,7 +2,7 @@
 
 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 # ! WARNING: generated by ModPerl::ParseSource/0.01
-# !          Mon Dec  6 09:38:51 2004
+# !          Tue Dec  7 13:02:32 2004
 # !          do NOT edit, any changes will be lost !
 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
@@ -5279,6 +5279,16 @@
       {
         'type' => 'CV *',
         'name' => 'cv'
+      }
+    ]
+  },
+  {
+    'return_type' => 'void',
+    'name' => 'mpxs_APR__Brigade_cleanup',
+    'args' => [
+      {
+        'type' => 'apr_bucket_brigade *',
+        'name' => 'brigade'
       }
     ]
   },

Reply via email to