I can increase the ulimit on the test host to allocate enough, however, we find that every connect/disconnect cycle will leave 25 or so file descriptors open ( use: ls /proc/`pidof java`/fd | wc -l on linux to get a count ). So after some long running load tests, we will hit a "Too many open files" error in Java, due to running out of file descriptors. I ran some small test code to verify this below ( an you verify this is an issue?).
Would this be something that's fixable in the SFS 2X client, or is it possibly an netty issue?
Thanks.
Code: Select all
public class SFSMain {
private static Logger log = LogManager.getLogger(SFSMain.class);
public static void main(String[] args) {
try {
Thread.sleep(30000);
SFSClient client = new SFSMain().new SFSClient();
for (int i = 0; i < 100; i++) {
client.connect();
Thread.sleep(1000);
client.disconnect();
}
} catch (InterruptedException e) {
log.error("error", e);
}
}
class SFSClient implements IEventListener {
private SmartFox sfsClient;
public SFSClient() {
sfsClient = new SmartFox();
}
public void connect() {
sfsClient.addEventListener(SFSEvent.CONNECTION, this);
sfsClient.setUseBlueBox(false);
sfsClient.connect("208.95.105.221", 3399);
}
public void disconnect() {
sfsClient.removeAllEventListeners();
sfsClient.disconnect();
}
@Override
public void dispatch(BaseEvent arg0) throws SFSException {
log.info("received event: {}", arg0);
}
}
}