Internal Exception: java.io.IOException: Connection reset by peer [duplicate]

On both my computers, the entire internet connection goes down when the Minecraft Server crashes. A reboot is needed to get the internet back.

Error is something like Internal exception: java.net.SocketException: Connection reset by peer

Why is this and how can I stop it?

EDIT: PCs are both XP SP3 and have RealTek integrated network cards

EDIT #2: I am accepting @Oak's answer since it a good summary for this problem, however in my case I deleted %appdata%\.minecraft\bin\minecraft.jar and let the game recreate it and it seems to have fixed the issue. At least for 2 people on a local network.... we'll find out later if it comes back when we get a few more friends on the server using our public IP.

EDIT #3: Problem came back again with more people on the server however the app linked below by Oak to buffer network packets fixed it


Solution 1:

Though I am not a Minecraft player, I was intrigued by this bug, so I went on a forum hunt. Conclusions:

Am I the only one with this problem?

Seems the problem is common:

  • http://getsatisfaction.com/mojang/topics/socketexception
  • http://www.minecraftforum.net/viewtopic.php?f=1013&t=104695
  • http://www.minecraftforum.net/viewtopic.php?f=17&t=107007

And even sometimes occurs in other Java applications:

  • http://forums.whirlpool.net.au/archive/730110

Do I HAVE to reboot?

Some people report that either

  • Logging off and on from the Windows account
  • Physically disconnecting and reconnecting the network cable

Will also fix the issue.

What causes it?

Some people claim it's a bug in the network driver, a limitation of a specific router, an issue with a specific modem, an over-saturation of network connections, a Java bug, a Windows bug... and all these people show that fixing the single thing they claim caused the problem, fixed the error :\

The truth appears to still be unknown, and the reason might even be different for different people, even though the symptoms are the same.

How do I solve it?

Different solutions appear to work for different people... here's a short summary of solutions that worked. I suggest trying one at a time and hoping one of them will work. Each of the solutions listed below have worked for more than one user but haven't worked for others.

Update the network adapter

The best thing I could find is this thread on the minecraftforum.net, and I advise reading it. Basically it suggests updating your network adapter drivers, and gives a good explanation of how to do it correctly for each of the affected cards.

Run the server from a virtual machine

The same thread as above suggests that if things still don't work, running the server inside a virtual machine - which is running something that isn't Windows XP - should work.

Use a different network adapter

Another solution which seemed to have worked for more than one player is using a different network card.

Buffer the network packets sent by Minecraft

In this thread, a user analyzes the connection and proposes to use an application to buffer the packets. He even wrote that application and uploaded it - maybe it's worth giving it a go.

Change network adapter settings

The following solution, taken from here, seemed to have worked for more than one user - even those not using an Atheros card (just find comparable settings):

Go to My Computer and right click on the icon.
Click on Properties.
Click on the Hardware tab, then click on the Device Manager button to open the Manager.
Click the little (+) icon next to Network Adapters.
Find your network adapter. For me it's called Atheros AR8121/AR8113 PCI-E Ethernet Controller.
Right click on it and go to Properties.
Click on the Advanced tab.
You should see a list of properties on the left and a combo box on the right.
In the properties list, click on Flow Control.
Make sure that is set to Off.
Next check the Max IRQ per Second and make sure that it's set to 5000.
Also check that Maximum Frame Size is set to 1514.
Now click on Number of Rx Buffers. Change this to the maximum value that it will support.
Do the same for the Number of Tx Buffers.

Solution 2:

The network driver is crashing the Internet and the Minecraft server. It's not Minecraft's fault.

There is a bug in the Realtek drivers. I had this same problem and traced it in the Windows event logs to an assert statement left in the drivers by the developers. Using different configs as suggested by Oak made it less frequent, but still happen. The reason you only notice it when running a server is due to the high network traffic it causes, making this one bit of buggy code more likely to be executed. I had seen the crash before I ran a server, but it was so rare I could never figure it out.

Since it was an unfixable driver bug, alternate drivers or a different card were the only solutions. Since no drivers are available for this chipset on Windows that are modern enough to run my card and lack the bug, my only solution was a different card. I went with an Intel, and now my machine has been on 24/7 for months without a crash.