This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 3765 - Connections leaking in Mono.Webserver.FastCgi
: Connections leaking in Mono.Webserver.FastCgi
Status: RESOLVED FIXED
Product: Class Libraries
Classification: Mono
Component: Sys.Web
: Trunk
: PC Linux
: --- normal
: ---
Assigned To: Bugzilla
:
:
:
:
  Show dependency treegraph
 
Reported: 2012-03-06 08:04 EST by Guillaume Pitel
Modified: 2012-03-14 16:20 EDT (History)
2 users (show)

See Also:
Tags:
Test Case URL:
External Submit: ---


Attachments

Description Guillaume Pitel 2012-03-06 08:04:20 EST
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 : 


if (IsConnected)
    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
Comment 1 Gonzalo Paniagua Javier 2012-03-14 16:20:38 EDT
Your fix has been merged in master.
Thanks!

Note You need to log in before you can comment on or make changes to this bug.