Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (7k points)

ERROR GServerHandler  - java.io.IOException: Connection reset by peer

java.io.IOException: Connection reset by peer

        at sun.nio.ch.FileDispatcher.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 org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:323)

        at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:282)

        at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:202)

        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

        at java.lang.Thread.run(Unknown Source)

This log is from a game server implemented using netty. What can cause this exception?

2 Answers

0 votes
by (13.1k points)

java.io.IOException: Connection reset by peer

The other side has abruptly aborted the connection in the midst of a transaction. That can have many causes which are not controllable from the server side. E.g. the end user decided to shut down the client or change the server abruptly while still interacting with your server or the client program has crashed, or the enduser’s internet connection went down, or the enduser’s machine crashed, etc.

Want to learn Java? Check out the core java certification from Intellipaat.

0 votes
by (1.8k points)
edited by

The Exception like java.io.IOException:connection reset by peer is thrown when a network connection is unexpectedly closed by the remote host but the local machine is still trying to read and write from the connection.

We can also say that the remote server or peer might have reset the connection instead of properly terminating it.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...