Re: Test::Aggregate results at the BBC

2008-01-03 Thread David Golden
On Jan 3, 2008 10:20 AM, Ovid [EMAIL PROTECTED] wrote:
 We couldn't reproduce the segfaults in the debugger or with
 Devel::Trace, but after a lot of work, a colleague and I found the
 culprit:  Contextual::Return.  Like Sub::Uplevel, it overrides
 CORE::GLOBAL::caller.  Apparently the two don't play well together, but
 it's very difficult to reproduce a minimal test case.  Merely by
 removing Contextual::Return from one module, the segfault went away.
 We don't know why.

Maybe it's too late, but which versions of Sub::Uplevel and
Contextual::Return were you using?

I attempted to fix Sub::Uplevel as of version 0.16 to play nicely with
Contextual::Return -- but as you said, finding a minimal test case is
difficult.

It's also a potential issue for Hook::LexWrap, so if I can find a
permanent fix, that would be a good thing.

David


Test::Aggregate results at the BBC

2008-01-03 Thread Ovid
My test aggregation took a bit longer to implement than Adrian's due to
several issues.  Some were bugs in tests, some were in code, but one
issue which took a *long* time to debug was random segfaults.

We couldn't reproduce the segfaults in the debugger or with
Devel::Trace, but after a lot of work, a colleague and I found the
culprit:  Contextual::Return.  Like Sub::Uplevel, it overrides
CORE::GLOBAL::caller.  Apparently the two don't play well together, but
it's very difficult to reproduce a minimal test case.  Merely by
removing Contextual::Return from one module, the segfault went away. 
We don't know why.

The aggregated tests, when run through t/aggregate.t, take 2m2s.

When run normally, they take 5m45s.  

Our test suite, which two months ago took 80m, is now 10m46s.

Cheers,
Ovid

--
Buy the book  - http://www.oreilly.com/catalog/perlhks/
Perl and CGI  - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog - http://use.perl.org/~Ovid/journal/


Re: Test::Aggregate results at the BBC

2008-01-03 Thread David Golden
On Jan 3, 2008 11:09 AM, Ovid [EMAIL PROTECTED] wrote:
 For smaller projects, you have fewer interactions.  For large projects,
 globally altered behavior is playing russian roulette without counting
 the bullets.

At least Sub::Uplevel documentation makes a point of warning in
several places about the dangers using it and how it overrides
CORE::GLOBAL::caller.  Contextual::Return is quite a bit more vague
about it.

The other general area of concern I would have for global vs local
behavior alteration is attributes.  E.g. combining custom attributes
handling with anything that is based on Attribute::Handlers.

David


Re: Test::Aggregate results at the BBC

2008-01-03 Thread David Cantrell
On Thu, Jan 03, 2008 at 07:20:38AM -0800, Ovid wrote:

 We couldn't reproduce the segfaults in the debugger or with
 Devel::Trace, but after a lot of work, a colleague and I found the
 culprit:  Contextual::Return.  Like Sub::Uplevel, it overrides
 CORE::GLOBAL::caller.

That probably explains the segfaults when using Hook::LexWrap in some
circumstances as well.  A few years ago I could reliably make perl
segfault by calling a wrapped function in void context - that is, just
throwing the result away.  At the time, the fix was:

  my $rubbish = wrapped_subroutine(...);

Unfortunately I forget what version of 5.8.x this was.  It might be in
the p5p archives.

-- 
David Cantrell | top google result for internet beard fetish club

  For every vengeance, there is an equal and opposite revengeance.
-- Cartoon Law X