[Mono-bugs] [Bug 464139] Socket leak

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Jan 7 11:56:26 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=464139

User amcgovern at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=464139#c3


Alan McGovern <amcgovern at novell.com> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
                 CC|                                                |amcgovern at novell.com




--- Comment #3 from Alan McGovern <amcgovern at novell.com>  2009-01-07 09:56:26 MST ---
>From my testing here's some more info on socket behaviour:

for (int i = 0; i < 100000; i++) {
    Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
    s.Bind(new IPEndPoint(IPAddress.Loopback, 10000 + i));
}

This does not appear to create a native handle. If you try to bind multiple
sockets to the same port, an exception is thrown saying that you can't use the
same ip/port combo twice. I assume what's happening is that the port number is
being reserved, but not actually committed.

Socket.Connect definitely instantiates a native handle.
Socket.Accept definitely instantiates a native handle.
Socket.Listen definitely instantiates a native handle.

Socket.Listen (int backlog) appears to instantiate 'backlog' native handles.
For example:

Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
s.Bind(new IPEndPoint(IPAddress.Loopback, port));
s.Listen(100);

This allows me to instantiate 321 listeners on win XP before i hit the limit of
max open sockets. If i change to s.Listen(500) i get 160 listeners. If i use
s.Listen (50) i get 642 listeners.

Hope this helps.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list