My setup : haproxy loadbalancing on several nginx locally with fastcgi backend connected with unix domain socket to several fastcgi-mono-server4.
haproxy (80) -> nginx (8080,8081,...) => /tmp/socket1, /tmp/socket2, ...
The problem is that fastcgi-mono-server4 fails to close the sockets it has accepted in some occasions (maybe 1 connection every 200), eventually leading to file descriptor exhaustion.
The problem seems to happen only with haproxy probes (simply doing a loop of wget does not seem to trigger the bug), I don't know why, though.
The bug is located in method EndRequest in XSP/src/Mono.WebServer.FastCgi/Connection.cs
This code :
new Record (1, RecordType.EndRequest, requestID,
body.GetData ()).Send (socket);
can throw an Exception if the socket is shut down on the client side, however the exception is silently caught and ignored at some upper level, thus preventing the request to be removed from the requests list, and preventing the socket to be properly closed.
I don't know if the bug occurs when using tcp sockets
Your fix has been merged in master.