I have a problem with kryonet that client disconnect. Can anyone help me to what would be a source of this problem?
using kryonet library, In order for client to stay connected, it needs to send and receive KeepAlive packets. A client thread is automatically handles this. but if my client do a heavy work ( Note: in another thread),It seems like it prevents the client thread from doing this.
the problem appear at reading big database table it take time to select some columns from table (which size per Gega)
but try to simplify the problem as much as possible by Creating a very large List in client side after server send anything to start task
after a lot of searching and expectation of the problem cause; I try
- different timeout thresholds
- different version of kryo 2.23 and 2.20
- using TCP and UPD connection (Note: I connect both in server and client)
here you are Client Code if received any object Do it in another thread:
@Override
public void received(Connection connection, Object object) {
if (object instanceof String) {
new Thread() {
@Override
public void run() {
final int RECORD_COUNT = 99999999;
final String RECORD = "Help I am trapped in a fortune cookie factory\n";
List<String> records = new ArrayList<String>(RECORD_COUNT);
for (long i = 0; i < RECORD_COUNT * 4; i++) {
records.add(RECORD);
}
}
}.start();
}
}
Client Log:
after some KeepAlive messages, it gives two type of messages (connection was aborted) or (connection timeout)
00:24 DEBUG: [kryo] Write: KeepAlive
00:28 DEBUG: [kryo] Read: KeepAlive
00:37 DEBUG: [kryo] Write: KeepAlive
00:37 DEBUG: [kryonet] Connection 7 update: An established connection was aborted by the software in your host machine
OR
00:35 DEBUG: [kryo] Read: KeepAlive
00:41 DEBUG: [kryo] Write: KeepAlive
00:50 DEBUG: [kryonet] Connection 8 timed out.
Server Log:
94:10 DEBUG: [kryo] Write: KeepAlive
94:11 DEBUG: [kryonet] Connection 7 timed out.
94:11 INFO: [kryonet] Connection 7 disconnected.