[dancer-users] BUG? client disconnect not handled in delayed route

Jason A. Crome jason at crome-plated.com
Sat Jan 30 16:03:01 EST 2021


Have you tried using Twiggy instead of Starman? delayed was intended to be used with AnyEvent or other Plack servers that support async (I don’t think the docs cover this well - sorry).

If Twiggy doesn’t resolve your issue, please provide some sample code to illustrate the problem you are having.

Thanks!
Jason

On Sat, Jan 23, 2021, at 11:30 AM, Paul Clements wrote:
> Hi,
> 
> I've been having trouble getting the server (tried the default PSGI
> one and Starman) to notice when a client disconnects from a delayed
> route handler. Long story short, I was able to finally debug this down
> to the content subroutine in DSL.pm. With the change below, I'm now
> able to detect and properly handle a disconnect (in my case, I'm just
> hitting ^C on a client curl session).
> 
> My question is: Does this seem like a proper fix (should I prepare a
> PR), or is there a better way to handle this?
> 
> - Paul
> 
> ---
> 
> $ diff -pu git/Dancer2/lib/Dancer2/Core/DSL.pm .
> --- git/Dancer2/lib/Dancer2/Core/DSL.pm 2020-12-31 11:21:47.490454726 -0500
> +++ ./DSL.pm    2021-01-23 11:07:47.464438846 -0500
> @@ -328,7 +328,8 @@ sub content {
>      }
> 
>      eval {
> -        $Dancer2::Core::Route::WRITER->write(@_);
> +        my $res = $Dancer2::Core::Route::WRITER->write(@_);
> +        die "Write Error\n" if (!defined($res));
>          1;
>      } or do {
>          my $error = $@ || 'Zombie Error';
> _______________________________________________
> dancer-users mailing list
> dancer-users at lists.preshweb.co.uk
> https://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>

-- 
Jason A. Crome / CromeDome
CPAN: https://metacpan.org/author/CROMEDOME
GitHub: https://github.com/cromedome
Twitter: https://twitter.com/cromedome
Blog: https://cromedome.net


More information about the dancer-users mailing list