From: Dave Rolsky Date: Sun, 18 Oct 2009 17:18:15 +0000 (+0000) Subject: Fix the "eternally growing stack trace" problem with the restarter. X-Git-Tag: 1.21~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Devel.git;a=commitdiff_plain;h=868361e89aa8a7178bf2085fbddbb195498b0a7f Fix the "eternally growing stack trace" problem with the restarter. Added this to changes, and cleaned up Changes text for the other change in there. --- diff --git a/Changes b/Changes index d1376b0..df08c05 100644 --- a/Changes +++ b/Changes @@ -1,7 +1,10 @@ This file documents the revision history for Perl extension Catalyst-Devel. - - Fix an issue with the Restarter in Win32 where @INC didn't get - passed along in "fork" + - The Restarter code cause stack traces for certain types of errors to + grow longer and longer with every restart. (Dave Rolsky) + + - Fixed an issue with the Restarter in Win32 where @INC didn't get + passed along when restarting. 1.20 2009-08-11 23:30:30 - Bump required File::ChangeNotify version to 0.07. Closes RT#48610. diff --git a/lib/Catalyst/Restarter.pm b/lib/Catalyst/Restarter.pm index 2e1980e..98c8286 100644 --- a/lib/Catalyst/Restarter.pm +++ b/lib/Catalyst/Restarter.pm @@ -75,8 +75,14 @@ sub run_and_watch { sub _restart_on_changes { my $self = shift; - my @events = $self->_watcher->wait_for_events(); - $self->_handle_events(@events); + # We use this loop in order to avoid having _handle_events() call back + # into this method. We used to do that, and the end result was that stack + # traces become longer and longer with every restart. Using the loop, the + # portion of the stack trace that covers this code never changes. + while (1) { + my @events = $self->_watcher->wait_for_events(); + $self->_handle_events(@events); + } } sub _handle_events { @@ -99,8 +105,6 @@ sub _handle_events { $self->_kill_child; $self->_fork_and_start; - - $self->_restart_on_changes; } sub DEMOLISH {