An existing connection was closed

68 views
Skip to first unread message

Sneh Tekriwal

unread,
Jun 28, 2015, 6:17:34 PM6/28/15
to kryone...@googlegroups.com
I am getting an exception in my client. Server is fine and no exception is thrown there

03:08 TRACE: [kryonet] Unable to update connection: Connection 3
java.io.IOException: An existing connection was forcibly closed by the remote host
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(Unknown Source)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
at sun.nio.ch.IOUtil.read(Unknown Source)
at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
at com.esotericsoftware.kryonet.TcpConnection.readObject(TcpConnection.java:107)
at com.esotericsoftware.kryonet.Client.update(Client.java:247)
at com.esotericsoftware.kryonet.Client.run(Client.java:333)
at java.lang.Thread.run(Unknown Source)

This exception occurs randomly and I am unable to reproduce it all the times. Any idea what is wrong? Let me know if you need more details. 

Joachim Durchholz

unread,
Jun 29, 2015, 2:14:04 AM6/29/15
to kryone...@googlegroups.com
Am 29.06.2015 um 00:17 schrieb Sneh Tekriwal:
> I am getting an exception in my client. Server is fine and no exception is
> thrown there
>
> 03:08 TRACE: [kryonet] Unable to update connection: Connection 3
> java.io.IOException: An existing connection was forcibly closed by the
> remote host

It is what the message says: The other side closed the connection.
You'll have to investigate on the other machine why it did that.

Sneh Tekriwal

unread,
Jun 29, 2015, 4:58:04 PM6/29/15
to kryone...@googlegroups.com
This is what i get on server

02:59 TRACE: [kryo] Write field: expGained (com.pokemonblazeonline.common.packets.BattleVictoryPacket)
02:59 TRACE: [kryo] Write: 100
02:59 TRACE: [kryo] Write field: moneyWon (com.pokemonblazeonline.common.packets.BattleVictoryPacket)
02:59 TRACE: [kryo] Write: 100
02:59 TRACE: [kryo] Write field: packet (com.pokemonblazeonline.common.packets.BattleVictoryPacket)
02:59 TRACE: [kryo] Write: null
02:59 TRACE: [kryo] Object graph complete.
02:59 TRACE: [kryonet] Unable to read TCP from: Connection 1
java.io.IOException: An established connection was aborted by the software in your host machine
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(Unknown Source)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
at sun.nio.ch.IOUtil.read(Unknown Source)
at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
at com.esotericsoftware.kryonet.TcpConnection.readObject(TcpConnection.java:107)
at com.esotericsoftware.kryonet.Server.update(Server.java:198)
at com.esotericsoftware.kryonet.Server.run(Server.java:356)
at java.lang.Thread.run(Unknown Source)
02:59  INFO: [kryonet] Connection 1 disconnected.
02:59 DEBUG: [kryonet] Unable to send TCP with connection: Connection 1
java.nio.channels.AsynchronousCloseException
at java.nio.channels.spi.AbstractInterruptibleChannel.end(Unknown Source)
at sun.nio.ch.SocketChannelImpl.write(Unknown Source)
at com.esotericsoftware.kryonet.TcpConnection.writeToSocket(TcpConnection.java:173)
at com.esotericsoftware.kryonet.TcpConnection.send(TcpConnection.java:204)
at com.esotericsoftware.kryonet.Connection.sendTCP(Connection.java:59)
at com.pokemonblazeonline.server.connections.ConnectionManager.sendUdp(ConnectionManager.java:17)
at com.pokemonblazeonline.server.battle.WildBattle.checkWildPokemonFainted(WildBattle.java:427)
at com.pokemonblazeonline.server.battle.WildBattle.checkForBattleOver(WildBattle.java:372)
at com.pokemonblazeonline.server.battle.WildBattle.executeUserPokemonSlower(WildBattle.java:315)
at com.pokemonblazeonline.server.battle.WildBattle.executeTurnWithBothPokemonMakingMove(WildBattle.java:255)
at com.pokemonblazeonline.server.battle.WildBattle.executeBattle(WildBattle.java:101)
at com.pokemonblazeonline.server.battle.WildBattle.lambda$0(WildBattle.java:62)
at com.pokemonblazeonline.server.battle.WildBattle$$Lambda$8/465728225.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)



--
You received this message because you are subscribed to the "kryonet-users" group.
http://groups.google.com/group/kryonet-users
--- You received this message because you are subscribed to a topic in the Google Groups "kryonet-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kryonet-users/qPw0pvtC15g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kryonet-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joachim Durchholz

unread,
Jun 29, 2015, 5:23:51 PM6/29/15
to kryone...@googlegroups.com
Am 29.06.2015 um 22:58 schrieb Sneh Tekriwal:
> 02:59 TRACE: [kryonet] Unable to read TCP from: Connection 1
> java.io.IOException: An established connection was aborted by the software
> in your host machine
> at sun.nio.ch.SocketDispatcher.read0(Native Method)
> at sun.nio.ch.SocketDispatcher.read(Unknown Source)
> at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
> at sun.nio.ch.IOUtil.read(Unknown Source)
> at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
> at
> com.esotericsoftware.kryonet.TcpConnection.readObject(TcpConnection.java:107)
> at com.esotericsoftware.kryonet.Server.update(Server.java:198)
> at com.esotericsoftware.kryonet.Server.run(Server.java:356)
> at java.lang.Thread.run(Unknown Source)

This looks like the JDK is reporting that the operating system closed
the connection for some reason (timeout, firewall, broken cable, other
side closed the connection, whatever).
I'd be somewhat surprised if this is related to KryoNet at all.

HTH
Jo

Sneh Tekriwal

unread,
Jun 29, 2015, 5:31:32 PM6/29/15
to kryone...@googlegroups.com
Oh well, now this is something plain random and annoying XD
I am really confused whether I should ignore this because it maybe a firewall issue or some OS issue or dig deep into it. Because I am testing it all on localhost so I am not sure how firewall issue can prevail. :/
And as much as I have tested it, this problem occurs with TCP only, not happens with UDP.

Joachim Durchholz

unread,
Jun 30, 2015, 4:10:46 AM6/30/15
to kryone...@googlegroups.com
Am 29.06.2015 um 23:31 schrieb Sneh Tekriwal:
> Oh well, now this is something plain random and annoying XD
> I am really confused whether I should ignore this because it maybe a
> firewall issue or some OS issue or dig deep into it. Because I am testing
> it all on localhost so I am not sure how firewall issue can prevail. :/

Oh, firewalls can affect localhost just like any other network
connection, it's just that that's an unusual configuration.

But you should really dig into it. You'll need to be able to distinguish
between locally-created, remotely-created and middlebox-created
problems, and if you feel you'll be having trouble diagnosing something
that's likely local, that's a skill you'll definitely need to acquire
before you start using physical networks.

> And as much as I have tested it, this problem occurs with TCP only, not
> happens with UDP.

It can't happen with UDP because UDP sends each package individually, so
it does not need a concept of "connection" to establish a sequence, so
there is no connection that could get closed.
Reply all
Reply to author
Forward
0 new messages