Skip to content

When the remote peer hangs up, a stash of errors are reported (on the error level in the log) #118

@hannesm

Description

@hannesm

We are running Dream for https://builds.robur.coop on a FreeBSD 12.2 machine. This works smoothly, and the footprint looks much smaller than our previous opium-based server.

One downside of dream (we're using the latest release - see https://builds.robur.coop/job/builder-web-freebsd/build/4b2a96cd-c922-4ee9-a786-475f49878562/f/opam-switch for the full set of opam packages we're using) is that client connection errors are reported in the log:

Jul  8 13:07:46 <daemon.notice> 192.168.42.4 daemon[42523]: 08.07.21 13:07:46.179      dream.http ERROR HTTP (192.168.0.6:39544): Unix.Unix_error(Unix.ECONNRESET, "read", "")
Jul  8 13:07:46 <daemon.notice> 192.168.42.4 daemon[42523]: 08.07.21 13:07:46.179      dream.http ERROR Raised by primitive operation at Lwt_unix.shutdown in file "src/unix/lwt_unix.cppo.ml", line 1677, characters 2-38
Jul  8 13:07:46 <daemon.notice> 192.168.42.4 daemon[42523]: 08.07.21 13:07:46.179      dream.http ERROR Called from Gluten_lwt_unix.Io.close.(fun) in file "src/vendor/gluten/lwt-unix/gluten_lwt_unix.ml", line 49, characters 10-47
Jul  8 13:07:46 <daemon.notice> 192.168.42.4 daemon[42523]: 08.07.21 13:07:46.179      dream.http ERROR Called from Lwt.Sequential_composition.catch in file "src/core/lwt.ml", line 2023, characters 16-20
Jul  8 13:07:46 <daemon.notice> 192.168.42.4 daemon[42523]: 08.07.21 13:07:46.180      dream.http ERROR Error handler raised: Failure("cannot write to closed writer")
Jul  8 13:07:46 <daemon.notice> 192.168.42.4 daemon[42523]: 08.07.21 13:07:46.180      dream.http ERROR Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
Jul  8 13:07:46 <daemon.notice> 192.168.42.4 daemon[42523]: 08.07.21 13:07:46.180      dream.http ERROR Called from Faraday.writable_exn in file "lib/faraday.ml" (inlined), line 191, characters 4-44
Jul  8 13:07:46 <daemon.notice> 192.168.42.4 daemon[42523]: 08.07.21 13:07:46.180      dream.http ERROR Called from Faraday.write_gen in file "lib/faraday.ml", line 234, characters 2-16
Jul  8 13:07:46 <daemon.notice> 192.168.42.4 daemon[42523]: 08.07.21 13:07:46.180      dream.http ERROR Called from Httpaf__Serialize.write_response in file "src/vendor/httpaf/lib/serialize.ml", line 65, characters 2-25
Jul  8 13:07:46 <daemon.notice> 192.168.42.4 daemon[42523]: 08.07.21 13:07:46.180      dream.http ERROR Called from Httpaf__Serialize.Writer.write_response in file "src/vendor/httpaf/lib/serialize.ml" (inlined), line 121, characters 4-37
Jul  8 13:07:46 <daemon.notice> 192.168.42.4 daemon[42523]: 08.07.21 13:07:46.180      dream.http ERROR Called from Httpaf__Server_connection.set_error_and_handle.(fun) in file "src/vendor/httpaf/lib/server_connection.ml", line 191, characters 10-47
Jul  8 13:07:46 <daemon.notice> 192.168.42.4 daemon[42523]: 08.07.21 13:07:46.180      dream.http ERROR Called from Dream__http__Error_handler.httpaf.(fun) in file "src/http/error_handler.ml", line 374, characters 17-39
Jul  8 13:07:46 <daemon.notice> 192.168.42.4 daemon[42523]: 08.07.21 13:07:46.180      dream.http ERROR Called from Lwt.Sequential_composition.catch in file "src/core/lwt.ml", line 2023, characters 16-20

This are logs reported via syslog to a syslog sink, that's why there are multiple headers.

Curious whether this only happens on FreeBSD, or on other systems as well when the client resets the connection before the HTTP request-response is done? It would be great to have an informational message about the connection reset, and keep the errors for actual server errors (at the moment, it is hard to derive anything from the number or errors reported via Logs, since a single connection reset (e.g. a port scanner or a TCP connection that is immediately reset) leads to 13 error message.

(On FreeBSD, you can use telnet/socat and tcpdrop to provoke a connection reset -- on Linux you may use tcpkill to reset the connection.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions