falcon icon indicating copy to clipboard operation
falcon copied to clipboard

Consider rescueing Async::TimeoutError in Falcon::Server

Open ainar-g opened this issue 5 years ago • 3 comments

I've been having a spurious Async::TimeoutError in my logs whenever a TCP connection to the client is closed. After some digging I've monkey-patched Falcon::Server like this:

module Falcon
  class Server < Async::HTTP::Server
    def accept(peer, address, task: Task.current)
      begin
        super
      rescue Async::TimeoutError
        Async.logger.debug(self) {"Client #{address.inspect} disconnected: timeout"}
      end
    end
  end
end

Unless I am mixing something up. Async::TimeoutError should be rescued here.

ainar-g avatar Jan 22 '19 16:01 ainar-g

Hmmm, thanks for this report. I'll check. So, it's actually the connect operation that's failing?

ioquatix avatar Jan 22 '19 20:01 ioquatix

Basically, I load the server on my localhost, make a few requests, wait a couple of minutes, and then I see Async::TimeoutError and the backtrace in red, which doesn't look very nice in logs.

ainar-g avatar Jan 22 '19 21:01 ainar-g

Okay, I will think about the best way to deal with this.

ioquatix avatar Jan 22 '19 21:01 ioquatix