Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: Dev

Re: svn commit: r1299669 - in /perl/modperl/trunk: Changes src/modules/perl/modperl_error.c xs/APR/Pool/APR__Pool.h xs/Apache2/ServerUtil/Apache2__ServerUtil.h

 

 

ModPerl dev RSS feed   Index | Next | Previous | View Threaded


fred at redhotpenguin

Mar 12, 2012, 11:03 AM

Post #1 of 2 (449 views)
Permalink
Re: svn commit: r1299669 - in /perl/modperl/trunk: Changes src/modules/perl/modperl_error.c xs/APR/Pool/APR__Pool.h xs/Apache2/ServerUtil/Apache2__ServerUtil.h

I'm not clear on the end user implications of this - how will the
error be presented now?

On Mon, Mar 12, 2012 at 6:27 AM, <torsten [at] apache> wrote:
> Author: torsten
> Date: Mon Mar 12 13:27:30 2012
> New Revision: 1299669
>
> URL: http://svn.apache.org/viewvc?rev=1299669&view=rev
> Log:
> Do not stringify $@ upon exception propagation.
>
> Modified:
>    perl/modperl/trunk/Changes
>    perl/modperl/trunk/src/modules/perl/modperl_error.c
>    perl/modperl/trunk/xs/APR/Pool/APR__Pool.h
>    perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h
>
> Modified: perl/modperl/trunk/Changes
> URL: http://svn.apache.org/viewvc/perl/modperl/trunk/Changes?rev=1299669&r1=1299668&r2=1299669&view=diff
> ==============================================================================
> --- perl/modperl/trunk/Changes (original)
> +++ perl/modperl/trunk/Changes Mon Mar 12 13:27:30 2012
> @@ -12,6 +12,8 @@ Also refer to the Apache::Test changes l
>
>  =item 2.0.6-dev
>
> +Do not stringify $@ upon exception propagation. [Torsten Foertsch]
> +
>  Fix a race condition in our tipool management.
>  See http://www.gossamer-threads.com/lists/modperl/dev/104026
>  Patch submitted by: SalusaSecondus <salusa [at] nationstates>
>
> Modified: perl/modperl/trunk/src/modules/perl/modperl_error.c
> URL: http://svn.apache.org/viewvc/perl/modperl/trunk/src/modules/perl/modperl_error.c?rev=1299669&r1=1299668&r2=1299669&view=diff
> ==============================================================================
> --- perl/modperl/trunk/src/modules/perl/modperl_error.c (original)
> +++ perl/modperl/trunk/src/modules/perl/modperl_error.c Mon Mar 12 13:27:30 2012
> @@ -78,7 +78,7 @@ void modperl_croak(pTHX_ apr_status_t rc
>     }
>
>     if (SvTRUE(ERRSV)) {
> -        Perl_croak(aTHX_ "%s", SvPV_nolen(ERRSV));
> +        Perl_croak(aTHX_ Nullch);
>     }
>
>     stash = gv_stashpvn("APR::Error", 10, FALSE);
>
> Modified: perl/modperl/trunk/xs/APR/Pool/APR__Pool.h
> URL: http://svn.apache.org/viewvc/perl/modperl/trunk/xs/APR/Pool/APR__Pool.h?rev=1299669&r1=1299668&r2=1299669&view=diff
> ==============================================================================
> --- perl/modperl/trunk/xs/APR/Pool/APR__Pool.h (original)
> +++ perl/modperl/trunk/xs/APR/Pool/APR__Pool.h Mon Mar 12 13:27:30 2012
> @@ -312,7 +312,7 @@ static apr_status_t mpxs_cleanup_run(voi
>  #endif
>
>     if (SvTRUE(ERRSV)) {
> -        Perl_croak(aTHX_ SvPV_nolen(ERRSV));
> +        Perl_croak(aTHX_ Nullch);
>     }
>
>     /* the return value is ignored by apr_pool_destroy anyway */
>
> Modified: perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h
> URL: http://svn.apache.org/viewvc/perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h?rev=1299669&r1=1299668&r2=1299669&view=diff
> ==============================================================================
> --- perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h (original)
> +++ perl/modperl/trunk/xs/Apache2/ServerUtil/Apache2__ServerUtil.h Mon Mar 12 13:27:30 2012
> @@ -80,7 +80,7 @@ static apr_status_t mpxs_cleanup_run(voi
>     }
>
>     if (SvTRUE(ERRSV)) {
> -        Perl_croak(aTHX_ SvPV_nolen(ERRSV));
> +        Perl_croak(aTHX_ Nullch);
>     }
>
>     /* the return value is ignored by apr_pool_destroy anyway */
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe [at] perl
For additional commands, e-mail: dev-help [at] perl


torsten.foertsch at gmx

Mar 13, 2012, 2:46 AM

Post #2 of 2 (411 views)
Permalink
Re: svn commit: r1299669 - in /perl/modperl/trunk: Changes src/modules/perl/modperl_error.c xs/APR/Pool/APR__Pool.h xs/Apache2/ServerUtil/Apache2__ServerUtil.h [In reply to]

On Monday, 12 March 2012 11:03:52 Fred Moyer wrote:
> I'm not clear on the end user implications of this - how will the
> error be presented now?

The only difference _should_ be like this. Suppose this code:

my $p=APR::Pool->new;
$p->cleanup_register(sub {die \"huhu"});
eval {undef $p};

Now, before the patch $@ would be a simple scalar string containing something
like "SCALAR(0x6375c8)" that is the stringified representation of \"huhu".
That is before the change C<'' eq ref $@> is true.

After the change $@ will contain the reference itself. Thus, C<print $@> will
still print the same string as before except for the trailing " at ... line
...\n" perhaps. But C<print ${$@}> will now print "huhu" and C<'SCALAR' eq ref
$@> is true.

Of course you can also throw other references, hashes, arrays or objects.

In general, I'd see it as a bug to be limited to exception strings only
because an arbitrary XS layer in the call hierarchy unconditionally
stringifies all exceptions.

However, on a second thought, I doubt that we have tests in our test suite
that actually check what happens if a PerlCleanupHandler or a pool cleanup
handler throw an exception. That may be worth some effort to investigate and
implement such tests.

Torsten Förtsch

--
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe [at] perl
For additional commands, e-mail: dev-help [at] perl

ModPerl dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.