Author: stas
Date: Fri Dec 31 16:25:13 2004
New Revision: 123834

URL: http://svn.apache.org/viewcvs?view=rev&rev=123834
Log:
APR::BucketAlloc: new now holds onto the pool object and doesn't release 
it until it itself is destroyed

Modified:
   perl/modperl/trunk/Changes
   perl/modperl/trunk/t/lib/TestAPRlib/bucket.pm
   perl/modperl/trunk/todo/release
   perl/modperl/trunk/xs/APR/BucketAlloc/APR__BucketAlloc.h

Modified: perl/modperl/trunk/Changes
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?view=diff&rev=123834&p1=perl/modperl/trunk/Changes&r1=123833&p2=perl/modperl/trunk/Changes&r2=123834
==============================================================================
--- perl/modperl/trunk/Changes  (original)
+++ perl/modperl/trunk/Changes  Fri Dec 31 16:25:13 2004
@@ -12,12 +12,6 @@
 
 =item 1.99_20-dev
 
-APR::Bucket::alloc_create moved  to APR::BucketAlloc::new
-APR::Bucket::alloc_destroy moved to APR::BucketAlloc::destroy [Stas]
-
-prefork handlers optimisation: don't dup the handler struct unless
-this is a threaded-mpm [Stas]
-
 deal with a situation where an object is used to construct another
 object, but it's then auto-DESTROYed by perl rendering the object that
 used it corrupted. the solution is to make the newly created objects
@@ -34,6 +28,13 @@
 - APR::URI: parse
 - Apache::RequestUtil: new
 - APR::Pool: new
+- APR::BucketAlloc: new
+
+APR::Bucket::alloc_create moved  to APR::BucketAlloc::new
+APR::Bucket::alloc_destroy moved to APR::BucketAlloc::destroy [Stas]
+
+prefork handlers optimisation: don't dup the handler struct unless
+this is a threaded-mpm [Stas]
 
 speed up the 'perl Makefile.PL' stage [Randy Kobes]:
  - reduce the number of calls to build_config() of

Modified: perl/modperl/trunk/t/lib/TestAPRlib/bucket.pm
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/t/lib/TestAPRlib/bucket.pm?view=diff&rev=123834&p1=perl/modperl/trunk/t/lib/TestAPRlib/bucket.pm&r1=123833&p2=perl/modperl/trunk/t/lib/TestAPRlib/bucket.pm&r2=123834
==============================================================================
--- perl/modperl/trunk/t/lib/TestAPRlib/bucket.pm       (original)
+++ perl/modperl/trunk/t/lib/TestAPRlib/bucket.pm       Fri Dec 31 16:25:13 2004
@@ -18,7 +18,7 @@
 use APR::Const -compile => 'SUCCESS';
 
 sub num_of_tests {
-    return 23;
+    return 21;
 }
 
 sub test {
@@ -170,22 +170,11 @@
 
     # alloc_create on out-of-scope pools
     {
-        my $data   = "foobartar";
-        my $offset = 3;
-        my $real = substr $data, $offset;
-        #my $ba = APR::BucketAlloc->new(APR::Pool->new);
-        my $b = APR::Bucket->new($ba, $data, $offset);
-
-        # try to overwrite the temp pool data
-        my $table = APR::Table::make(APR::Pool->new, 50);
-        $table->set($_ => $_) for 'aa'..'za';
-
-        # now test that we are still OK
-        my $rlen = $b->read(my $read);
-        ok t_cmp $read, $real, 'new($data, $offset)/buffer';
-        ok t_cmp $rlen, length($read), 'new($data, $offset)/len';
-        ok t_cmp $b->start, $offset, 'offset';
-
+        # later may move that into a dedicated bucket_alloc test
+        my $ba = APR::BucketAlloc->new(APR::Pool->new);
+        # here if the pool is gone of scope destroy() will segfault
+        $ba->destroy;
+        ok 1;
     }
 
     # setaside on out-of-scope pools

Modified: perl/modperl/trunk/todo/release
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/todo/release?view=diff&rev=123834&p1=perl/modperl/trunk/todo/release&r1=123833&p2=perl/modperl/trunk/todo/release&r2=123834
==============================================================================
--- perl/modperl/trunk/todo/release     (original)
+++ perl/modperl/trunk/todo/release     Fri Dec 31 16:25:13 2004
@@ -8,32 +8,3 @@
   give any more details, but I suspect that it's due to
   ModPerl::Util::unload_package() which perfectly fits the timing when
   the leak was introduced (when PerlRun started to use unload_package).
-
-* we need to deal with a situation where an object is used to
-  construct another object, but it's then auto-DESTROYed by perl
-  rendering the object that used it corrupted.
-
-  the solution is to make the newly created objects refer to the
-  underlying object via magic attachment.
-
-  only objects using objects that have DESTROY are effected, so for
-  example in the case of:
-
-  APR::Bucket::eos_create(APR::Bucket::alloc_create(APR::Pool->new)
-
-  the object returned by eos_create shouldn't be affected, since
-  alloc_create()'s object doesn't have perl's DESTROY. so only the
-  pool object is an issue here (i.e. alloc_create needs special
-  handling)
-
-  relevant objects with DESTROY : Apache::SubRequest,
-  APR::ThreadMutex, APR::UUID, APR::Pool
-
-
-  =================
-  === APR::Pool ===
-  =================
-  *** returning objects ***
-
-  APR::Bucket:
-  V apr_bucket_alloc_create

Modified: perl/modperl/trunk/xs/APR/BucketAlloc/APR__BucketAlloc.h
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/xs/APR/BucketAlloc/APR__BucketAlloc.h?view=diff&rev=123834&p1=perl/modperl/trunk/xs/APR/BucketAlloc/APR__BucketAlloc.h&r1=123833&p2=perl/modperl/trunk/xs/APR/BucketAlloc/APR__BucketAlloc.h&r2=123834
==============================================================================
--- perl/modperl/trunk/xs/APR/BucketAlloc/APR__BucketAlloc.h    (original)
+++ perl/modperl/trunk/xs/APR/BucketAlloc/APR__BucketAlloc.h    Fri Dec 31 
16:25:13 2004
@@ -23,7 +23,7 @@
     apr_pool_t *p          = mp_xs_sv2_APR__Pool(p_sv);
     apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p);
     SV *ba_sv = sv_setref_pv(NEWSV(0, 0), "APR::BucketAlloc", (void*)ba);
-    //mpxs_add_pool_magic(ba_sv, p_sv);
+    mpxs_add_pool_magic(ba_sv, p_sv);
     return ba_sv;
 }
 

Reply via email to