Re: svn commit: r1676417 - /perl/modperl/trunk/src/modules/perl/modperl_interp.c

Jan Kaluža <[email protected]>
Newsgroups gmane.comp.apache.mod-perl.devel
Message-ID <[email protected]>
On 05/14/2015 11:24 AM, Niko Tyni wrote:
> On Sun, May 10, 2015 at 01:47:19PM +0100, Steve Hay wrote:
>> On 28 April 2015 at 07:51,  <[email protected]> wrote:
>>> Author: jkaluza
>>> Date: Tue Apr 28 06:51:12 2015
>>> New Revision: 1676417
>>>
>>> URL: http://svn.apache.org/r1676417
>>> Log:
>>> Initialize interp->refcnt to 1 in modperl_interp_select.
>
>> I cannot understand why, but since this patch was applied I find that
>> t\modules\proxy.t fails every time when I run the full "nmake test",
>> but it always succeeds when I run it in isolation so I'm at a loss to
>> find out what is going wrong. All other tests (apart from those known
>> Win32-specific failures documented in README) still pass. Reverting
>> the patch "fixes" the proxy.t problem, but probably isn't the right
>> solution.

It's caused by Perl_croak/modperl_croak.

Lets take modperl_run_filter as an example. When following code-path is 
executed ...

                 modperl_croak(aTHX_ MODPERL_FILTER_ERROR,
                               "a filter calling $f->read "
                               "must return OK and not DECLINED");

... the MP_INTERP_PUTBACK is not reached for some reason (I presume it's 
because of Perl_croak, but I don't understand why it stops the execution 
of the rest of modperl_run_filter method).

Because of that, the interp->refcnt is not decreased, and the interp is 
not freed.

I has been able to "fix" it by attached patch, but I would like to 
discuss more generic way how to fix that problem...

Any ideas?

Regards,
Jan Kaluza

> As a data point, this also seems to happen with 2.0.9-RC1 on Debian
> kfreebsd-amd64.
>
>    https://buildd.debian.org/status/fetch.php?pkg=libapache2-mod-perl2&arch=kfreebsd-amd64&ver=2.0.9~rc1-1&stamp=1431587841
>
>    request has failed (the response code was: 502)
>    see t/logs/error_log for more details
>    t/modules/proxy.t .......................
>    # connecting to http://localhost:8538/TestModules__proxy
>    1..1
>    # Running under perl version 5.020002 for gnukfreebsd
>    # Current time local: Thu May 14 07:15:21 2015
>    # Current time GMT:   Thu May 14 07:15:21 2015
>    # Using Test.pm version 1.26
>    # Using Apache/Test.pm version 1.39
>    Dubious, test returned 2 (wstat 512, 0x200)
>    Failed 1/1 subtests
>
> I haven't been able to test yet whether it's reproducible there.
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
mod_perl-trunk-refcnt.patch (text/x-diff, 622 B)
Index: src/modules/perl/modperl_filter.c
===================================================================
--- src/modules/perl/modperl_filter.c	(revision 1679170)
+++ src/modules/perl/modperl_filter.c	(working copy)
@@ -535,6 +535,7 @@
                  * pass the bucket brigade through after it called
                  * $f->read(), since it causes a pre-fetch of the
                  * bb */
+                interp->refcnt--;
                 modperl_croak(aTHX_ MODPERL_FILTER_ERROR,
                               "a filter calling $f->read "
                               "must return OK and not DECLINED");
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.