[dancer-users] BUG? client disconnect not handled in delayed route
Paul Clements
paul.clements at us.sios.com
Wed Feb 3 21:20:56 EST 2021
On Sat, Jan 30, 2021, Jason Crome wrote:
> 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
[ I'm not subscribed to the list, so Jason's reply didn't go directly
to me, but just to confirm for anyone out there who may have a similar
question in the future. ]
Twiggy does indeed handle the problem below without any additional code changes.
Thanks to Jason Crome for the tip.
-- Paul
On Sat, Jan 23, 2021 at 11:30 AM Paul Clements
<paul.clements at us.sios.com> 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';
More information about the dancer-users
mailing list