battlecode-server-2017 icon indicating copy to clipboard operation
battlecode-server-2017 copied to clipboard

Avoid a NullPointerException in NetServer.onError

Open simonlindholm opened this issue 8 years ago • 2 comments

I saw the following stack trace:

Exception in thread "WebsocketSelector14" java.lang.NullPointerException
        at battlecode.server.NetServer.onError(NetServer.java:165)
        at org.java_websocket.server.WebSocketServer.handleFatal(WebSocketServer.java:439)
        at org.java_websocket.server.WebSocketServer.run(WebSocketServer.java:287)
        at java.lang.Thread.run(Thread.java:745)

and indeed the first argument to onError can sometimes be null, so this seems like a reasonable fix.

simonlindholm avatar Jan 22 '17 16:01 simonlindholm

How did you obtain this error? I was able to reproduce this exception by starting two instances of the server simultaneously, but this produces fairly seriously erroneous behavior across the server, and is in general not supported.

jbloxham avatar Jan 22 '17 22:01 jbloxham

Yeah, I think I got that from running two servers at the same time (trying to parallelize testing).

simonlindholm avatar Jan 22 '17 22:01 simonlindholm