plack / Plack

PSGI toolkit and server adapters
http://plackperl.org/
Other
486 stars 214 forks source link

Plack::Handler::FCGI SIGPIPE handler #670

Open defc0n opened 2 years ago

defc0n commented 2 years ago

It is possible the socket it is trying to write to is no longer connected (remote client closed it on us), in which case the following could happen as an example in a Catalyst FCGI app:

Trace begun
__ANON__('Caught SIGPIPE at .../lib/perl5/Plack/Handler/FCGI.pm line 205.^J') called at .../lib/perl5/Plack/Handler/FCGI.pm line 205
Plack::Handler::FCGI::_handle_response('Plack::Handler::FCGI=HASH(0x18bc9898)', 'ARRAY(0x19d195a8)') called at .../lib/perl5/Plack/Handler/FCGI.pm line 154
Plack::Handler::FCGI::__ANON__('ARRAY(0x19d195a8)') called at .../lib/perl5/Plack/Util.pm line 337
Plack::Util::__ANON__('ARRAY(0x19d195a8)') called at .../lib/perl5/Plack/Util.pm line 337
Plack::Util::__ANON__('ARRAY(0x19d195a8)') called at .../lib/perl5/Plack/Util.pm line 337
Plack::Util::__ANON__('ARRAY(0x19d195a8)') called at .../lib/perl5/Plack/Util.pm line 337
Plack::Util::__ANON__('ARRAY(0x19d195a8)') called at .../lib/perl5/Plack/Util.pm line 337
Plack::Util::__ANON__('ARRAY(0x19d195a8)') called at .../lib/perl5/Plack/Util.pm line 337
Plack::Util::__ANON__('ARRAY(0x19d195a8)') called at ...lib/perl5/Plack/Util.pm line 337
Plack::Util::__ANON__('ARRAY(0x19d195a8)') called at .../lib/perl5/Plack/Middleware/HTTPExceptions.pm line 32
Plack::Middleware::HTTPExceptions::__ANON__('ARRAY(0x19d195a8)') called at .../lib/perl5/Plack/Util.pm line 337
Plack::Util::__ANON__('ARRAY(0x19d195a8)') called at .../lib/perl5/Catalyst/Engine.pm line 133
Catalyst::Engine::finalize_body('Catalyst::Engine=HASH(0x15399c50)', 'App=HASH(0x1aad1e80)') called at ...lib/perl5/Catalyst.pm line 2236

Could Plack::Handle::FCGIs catch/gracefully handle this possibility and move on to the next request if so?