Skip Menu |

This queue is for tickets about the PadWalker CPAN distribution.

Report information
The Basics
Id: 64553
Status: open
Priority: 0/
Queue: PadWalker

People
Owner: Nobody in particular
Requestors: dwheeler [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



CC: rafl [...] debian.org
Subject: PATCH: Fix for handling stale pads
Date: Thu, 6 Jan 2011 11:29:35 -0800
To: bug-padwalker [...] rt.cpan.org
From: "David E. Wheeler" <dwheeler [...] cpan.org>
I ran into a crash in my Plack app using Devel::StackTrace::WithLexicals. I managed to get it down to this relatively simple test case: #!/usr/bin/env perl use 5.12.0; use utf8; use Devel::StackTrace::WithLexicals; use Router::Resource; use Plack::Builder; builder { my $mids = [['StackTrace']]; mount '/pub' => builder { my $router = router { resource '/' => sub { GET { die 'WTF'; }; }; }; mount '/' => builder { enable @{ $_ } for @{ $mids }; sub { $router->dispatch(shift) }; }; }; }; Throw that into a file, then `plackup file.psgi`, then hit http://localhost:5000/pub/ to see the crash appear in the terminal. Florian Ragwitz took that and broke it down a bit more and came up with the attached patch, which fixes the crash. I guess it was difficult to come up with a test case to put into the PadWalker test suite, but I think he has a simpler test case than the above that he'll reply with in a bit. Thanks, David

Message body is not shown because sender requested not to inline it.

New Plack-free test case from Miyagawa: #!/usr/bin/env perl use 5.12.0; use Devel::StackTrace::WithLexicals; use Devel::StackTrace::AsHTML; my $c = sub { my @foo = qw( a b c ); sub { my $x = sub { die "Foo" }; 1 for @foo; $x->(); }; }; my $x; $SIG{__DIE__} = sub { $x = Devel::StackTrace::WithLexicals->new; die @_; }; eval { $c->()->() }; $x->as_html;
Test case from Florian: use strict; use warnings; use Test::More tests => 1; use PadWalker 'peek_my'; my $c = sub { my $foo = 42; sub { 1 if $foo; # make sure to close over $foo sub { die "Foo\n" }->(); }; }; { local $SIG{__DIE__} = sub { my $fail = \peek_my(1)->{'$foo'}; die @_; }; eval { $c->()->() }; } is $@, "Foo\n";
RT-Send-CC: rafl [...] debian.org
*BUMP* FWIW, here's the simplest test case Florian came up with: https://gist.github.com/866256 So, any chance of seeing a fix soonish? Thanks, David
On Fri Mar 11 12:57:10 2011, DWHEELER wrote: Show quoted text
> *BUMP* > > FWIW, here's the simplest test case Florian came up with: > > https://gist.github.com/866256 > > So, any chance of seeing a fix soonish?
And the patch is here: https://gist.github.com/964912. David