Skip Menu |

This queue is for tickets about the Plack-Middleware-Timeout CPAN distribution.

Report information
The Basics
Id: 133535
Status: open
Priority: 0/
Queue: Plack-Middleware-Timeout

People
Owner: Nobody in particular
Requestors: spam [...] nowaker.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Request terminated with 504 even though it's not a timeout
Date: Wed, 14 Oct 2020 14:09:17 -0500
To: bug-Plack-Middleware-Timeout [...] rt.cpan.org
From: Damian Nowak <spam [...] nowaker.net>
When the underlying code during request handling exits with an error, Plack::Middleware::Timeout catches it and treats it as if it was a timeout, and responds with 504. This should not happen. Plack::Middleware::Timeout should only trigger its response handling if the timeout has been *actually* reached. Any errors in the underlying code should be passed untouched to middlewares before Plack::Middleware::Timeout for handling, like Plack::Middleware::Stacktrace or Plack::Middleware::Sentry. Result without Plack::Middleware::Timeout: Can't call method "XXX" on an undefined value at /YYY.pm line ZZZ (provided by Plack::Middleware::StackTrace) Result with Plack::Middleware::Timeout: HTTP ERROR 504 Expected result with Plack::Middleware::Timeout: Can't call method "XXX" on an undefined value at /YYY.pm line ZZZ (Plack::Middleware::Timeout to ignore the error, as no timeout has occurred)
Subject: Re: [rt.cpan.org #133535] AutoReply: Request terminated with 504 even though it's not a timeout
Date: Wed, 14 Oct 2020 16:15:13 -0500
To: bug-Plack-Middleware-Timeout [...] rt.cpan.org
From: Damian Nowak <spam [...] nowaker.net>
This code needs to be added after } or do { if ( time() - $time_started < $self->timeout ) { # It's not a timeout. The underlying code errored out. die $_; } I've found the GitHub repo of this project, and will submit a PR there.
Subject: Re: [rt.cpan.org #133535] AutoReply: Request terminated with 504 even though it's not a timeout
Date: Wed, 14 Oct 2020 16:29:13 -0500
To: bug-Plack-Middleware-Timeout [...] rt.cpan.org
From: Damian Nowak <spam [...] nowaker.net>
FYI, I've found an even elegant way of achieving the same result - it's to check if the error equals to $alarm_msg.
Subject: Re: [rt.cpan.org #133535] AutoReply: Request terminated with 504 even though it's not a timeout
Date: Wed, 14 Oct 2020 18:21:54 -0500
To: bug-Plack-Middleware-Timeout [...] rt.cpan.org
From: Damian Nowak <spam [...] nowaker.net>
On 2020-10-14 12:09:34, spam@nowaker.net wrote: Show quoted text
> When the underlying code during request handling exits with an error, > Plack::Middleware::Timeout catches it and treats it as if it was a timeout, > and responds with 504.
I think you can probably also solve this by reordering your middleware -- so the error is never seen by this middleware because a different one properly caught and handled the error first before it gets to this layer.