robur-coop / httpcats

A simple http client/server (http/1.1 & h2) for OCaml 5
Other
33 stars 6 forks source link

server silent crash #3

Closed Swrup closed 6 months ago

Swrup commented 6 months ago

Hello,

I encountered this problem when making a website with modestly sized cat pictures.

The server crashed after some requests. It seems to happen with big response and often after some Unexpected exception: \"Unix.Unix_error(Unix.ECONNRESET, write, ..." or "Unix.ENOTCONN, shutdown, ... ".

I reproduced it on this branch in the example: https://github.com/Swrup/httpcats/tree/silent-crash-debug When I run this modified example and connect to it with firefox, the server crashes after a few F5

dinosaure commented 6 months ago

It should be fixed by https://git.robur.coop/robur/httpcats/pulls/4, can you retest?

dinosaure commented 6 months ago

Yes, it's due to a SIGPIPE unfortunately. The error is well-known and we must ignore SIGPIPE (and catch properly EPIPE when we write something to close everything). The ENOTCONN should be ignored too I think when it appears when everything was done - on this question, we need to formalize how to properly close a TCP/IP connection but let's ignore that as piaf does.

Swrup commented 6 months ago

nice its seems to work well now

thanks