Well, not exactly crashed the server, but I stopped it from running which is a proof of concept.
With a simple Java program which sends legitimate requests from a legitimate device, the server failed after a few minutes. A quick manual restart over ssh got it up and running immediately.
public class BullyServerTest {
public static BullyServerTest bst;
public static void main(String[] args) {
bst = new BullyServerTest();
}
boolean quit = false;
private final String server_host = "SOMEWEBADDRESS"; // LOL
private final int server_port = SOMESECRETNUMBER;
private final String home = System.getProperty("user.home") + "/";
public BullyServerTest() {
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
quit = true;
try { Thread.sleep(1000); } catch (InterruptedException ex) {}
}
});
while (!quit) {
try { Thread.sleep(randInt(10, 250)); } catch (InterruptedException ex) {}
do_hello_world_bully();
}
}
Random rand = new Random();
private int randInt(int min, int max) {
return rand.nextInt((max - min) + 1) + min;
}
private static final int COMMAND_HELLO = 1234;
private void do_hello_world_bully() {
int count = randInt(10, 100);
System.out.println("HELLO WORLD BULLY at " + count + " times");
while (count-- != 0) { // a shed load of threads at once
new Thread(runnable_HW).start();
}
System.out.println("Completed...");
}
Runnable runnable_HW = new Runnable() {
@Override
public void run() {
try {
WLSocket socket = new WLSocket(server_host, server_port);
socket.out.writeInt(COMMAND_HELLO);
String hello = socket.in.readUTF();
} catch (IOException ex) {
System.out.println("Server failed with HELLO WORLD response");
}
}
};
}
So the next step is to implement a thread pool so that the server will not hang on too many requests. It ran for less than a minute. The above program kept running until my 12Gb RAM ran out which was a bit longer. The current server does only have 4Gb RAM and couldn’t handle the amount of connections at once. I’ve also had to keep the sudden bandwidth usage down as I was hitting my upload and download limits.
Eventually the server and client code will all be rewritten in C++ and handle such things as low latency timeouts.
This has been a very interesting test. I’ll be leaving the hello world server command in for future testing to simulate fake requests.

