Skip to content

Commit

Permalink
Die if Shotgun is running on Win32. Fix #400
Browse files Browse the repository at this point in the history
  • Loading branch information
miyagawa committed May 8, 2013
1 parent dfb4a01 commit 89f7101
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/Plack/Loader/Shotgun.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ use Storable;
use Try::Tiny;
use Plack::Middleware::BufferedStreaming;

die <<DIE if $^O eq 'MSWin32' && !$ENV{PLACK_SHOTGUN_MEMORY_LEAK};
Shotgun loader uses fork(2) system call to create a fresh Perl interpreter, that is known to not work
properly in a fork-emulation layer on Windows and cause huge memory leaks.
If you're aware of this and still want to run the loader, run it with the environment variable
PLACK_SHOTGUN_MEMORY_LEAK on.
DIE

sub preload_app {
my($self, $builder) = @_;
$self->{builder} = sub { Plack::Middleware::BufferedStreaming->wrap($builder->()) };
Expand Down

0 comments on commit 89f7101

Please sign in to comment.