[MC-2670] Java SocketException on shutdown Created: 10/Nov/12  Updated: 07/Feb/15  Resolved: 11/Jan/14

Status: Resolved
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Minecraft 1.4.4, Minecraft 1.6.2, Minecraft 13w39b, Minecraft 1.7.4
Fix Version/s: Minecraft 1.7.4

Type: Bug
Reporter: Michael Aldridge Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Environment:

Ubuntu Server 12.04 LTS with openJDK 7. I can supply build numbers upon request.


Issue Links:
Duplicate
is duplicated by MC-13575 Server error message! Resolved
is duplicated by MC-16653 When stopping a server, a SocketExcep... Resolved
is duplicated by MC-17244 Server doesn't always save world on S... Resolved
is duplicated by MC-91 java.net.SocketException: Socket clos... Resolved
Relates
relates to MC-10976 Async FileSavingProcess will cause ch... Resolved
Confirmation Status: Unconfirmed

 Description   

Every time I issue the "stop" command, this happens:

java.net.SocketException: Socket closed
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398)
        at java.net.ServerSocket.implAccept(ServerSocket.java:522)
        at java.net.ServerSocket.accept(ServerSocket.java:490)
        at hu.run(SourceFile:66)

This happens every time I stop the server, I only run bleeding edge builds on this server, but it is annoying that they don't make clean exits. Additionally, either it isn't working or doesn't exist, but sigint quits java, not minecraft, which makes writing a good init.d script nigh impossible.



 Comments   
Comment by Christie N [ 25/Jan/14 ]

An error like this is still present in 1.7.4, but inconsistent. (sometimes it shows, sometimes not)

Comment by Lei Zhao [ 26/Nov/13 ]

Talven81, my 1.7.2 server is not throwing exceptions on shutdown anymore.

Comment by Talven81 [ 26/Nov/13 ]

Is this still a concern in the current Minecraft version 1.7.2 / Launcher version 1.3.4 ? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

Comment by xPaw [ 03/Oct/13 ]

This is still happening on latest snapshot.

[14:34:09] [Server Listen Thread/ERROR]: Exception handling pending connection
java.net.SocketException: Socket closed
        at java.net.PlainSocketImpl.socketAccept(Native Method) ~[?:1.7.0_25]
        at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398) ~[?:1.7.0_25]
        at java.net.ServerSocket.implAccept(ServerSocket.java:530) ~[?:1.7.0_25]
        at java.net.ServerSocket.accept(ServerSocket.java:498) ~[?:1.7.0_25]
        at jt.run(SourceFile:66) [minecraft_server.jar:?]
Comment by Kumasasa [ 31/Jul/13 ]

Ok, reopened.

Comment by Lei Zhao [ 31/Jul/13 ]

Agree with Michael. How could this be intended?? You should catch the exception and give a better message.

Comment by Michael Aldridge [ 28/May/13 ]

it is intended to throw errors on shutdown? In my experience, good code doesn't do that! I can look into it with oracle java, but seeing as that is EOL for my platform, I was trying to migrate away from it.

Comment by Gravious [ 27/May/13 ]

It is a SocketException, therefore it is thrown inside of a 'try'-loop, most definitely something that is not intended to be there.

Also, perhaps the title should be changed to "Java SocketException on shutdown", as I wasn't able to find it by searching for those keywords.

Comment by Kumasasa [ 10/Nov/12 ]

This message is just telling you "Socket closed" nothing else. There is no error, this is normal.

Comment by Selbram (Tory Clement) [ 10/Nov/12 ]

Do you get the same error with Oracle Java? Better question, Would you be willing to test Oracle Java to see if it gives the same error?

Generated at Sun Jan 12 11:58:40 UTC 2025 using Jira 9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13.