Skip to content

GameScanners - Socket Exception #2

@nitral

Description

@nitral

The Game Scanners are currently unreliable and due to some reason work on one machine and not on the other. The machine currently hosting the hub is facing problems. For example, it works absolutely fine on my Windows 7 machine. However when I tried it in my Ubuntu 12.04LTS, it immediately broke down!

On my Linux machine, while preparing sockets, it pops up:

java.net.SocketException: Too many open files
    at java.net.PlainDatagramSocketImpl.datagramSocketCreate(Native Method)
    at java.net.AbstractPlainDatagramSocketImpl.create(AbstractPlainDatagramSocketImpl.java:82)
    at java.net.DatagramSocket.createImpl(DatagramSocket.java:322)
    at java.net.DatagramSocket.<init>(DatagramSocket.java:179)
    at CODServerQueryDemo.prepareSockets(CODServerQueryDemo.java:140)
    at CODServerQueryDemo.main(CODServerQueryDemo.java:26)

It is able to catch this. Execution moves forward.
Then it successfully creates the template request packet.
Then it breaks down again while sending packets through these sockets.

java.lang.NullPointerException
    at CODServerQueryDemo.sendRequests(CODServerQueryDemo.java:106)
    at CODServerQueryDemo.main(CODServerQueryDemo.java:41)

It handles this too. Execution moves forward.
The main thread sleeps for 20ms.
Then, it breaks down again while getting responses and it not able to recover.

Exception in thread "main" java.lang.NullPointerException
    at CODServerQueryDemo.getResponse(CODServerQueryDemo.java:75)
    at CODServerQueryDemo.main(CODServerQueryDemo.java:48)

I have JRE build 1.7.0_10-b18 and javac version 1.7.0_10
The original host machine scored a time of ~ 6 seconds in scanning the subnets mentioned in the source code of the scanners.
I believe the reason is that the program is not able to open that many sockets. Currently, it tries opens 5610 sockets. One for each IP on the network. That's just too much! Perhaps, a way out is to not make that many socket and reuse the ones we create.
We need to rethink the strategy we use to ping servers for information. Or at least rethink the flow of the current strategy so it works.

Ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions