-
Bug
-
Resolution: Unresolved
-
None
-
Minecraft 13w39a, Minecraft 13w39b, Minecraft 13w41a, Minecraft 13w41b, Minecraft 13w42b, Minecraft 13w43a, Minecraft 1.7, Minecraft 1.7.1, Minecraft 1.7.2, Minecraft 13w47a, Minecraft 13w47b, Minecraft 13w47c, Minecraft 1.7.4, Minecraft 14w04b, Minecraft 14w05b, Minecraft 14w06a, Minecraft 1.7.5, Minecraft 14w11b, Minecraft 1.7.8, Minecraft 1.7.9, Minecraft 14w21b, Minecraft 14w28a, Minecraft 14w30b, Minecraft 1.8.1, Minecraft 1.8.3, Minecraft 1.8.8, Minecraft 15w51b, Minecraft 1.12.1, Minecraft 1.12.2 Pre-Release 1, Minecraft 1.12.2 Pre-Release 2, Minecraft 1.12.2, Minecraft 17w43a, Minecraft 17w43b, Minecraft 18w01a, Minecraft 1.13, Minecraft 19w11b, Minecraft 19w13b, 1.14.4, 19w42a, 1.15.2, 20w18a, 20w19a, 1.18.1, 22w03a, 1.18.2, 1.19, 1.19.2, 22w42a, 1.20.1, 1.20.2, 24w12a, 1.21, 1.21.1, 1.21.3
-
Confirmed
-
Dedicated Server
-
Low
-
Platform
This error should not have any side effects and can be ignored (see section "Code analysis" for an explanation).
When starting the server from the command line no error is logged, for example:
java -Xmx1024M -Xms1024M -jar server.jar
The bug
When the dedicated server is started by double clicking the .jar file it logs the following error on startup:
[09:23:17 ERROR]: Exception handling console input java.io.IOException: The handle is invalid at java.io.FileInputStream.readBytes(Native Method) ~[?:1.8.0_172] at java.io.FileInputStream.read(Unknown Source) ~[?:1.8.0_172] at java.io.BufferedInputStream.read1(Unknown Source) ~[?:1.8.0_172] at java.io.BufferedInputStream.read(Unknown Source) ~[?:1.8.0_172] at sun.nio.cs.StreamDecoder.readBytes(Unknown Source) ~[?:1.8.0_172] at sun.nio.cs.StreamDecoder.implRead(Unknown Source) ~[?:1.8.0_172] at sun.nio.cs.StreamDecoder.read(Unknown Source) ~[?:1.8.0_172] at java.io.InputStreamReader.read(Unknown Source) ~[?:1.8.0_172] at java.io.BufferedReader.fill(Unknown Source) ~[?:1.8.0_172] at java.io.BufferedReader.readLine(Unknown Source) ~[?:1.8.0_172] at java.io.BufferedReader.readLine(Unknown Source) ~[?:1.8.0_172] at sn$2.run(SourceFile:107) [server.jar:?]
Code analysis
It seems that the reason for this is that the server can process commands provided from the command prompt (System.in) and independently from the JTextField. In case you do not start the server using the command prompt it still tries to read the input from it which is not possible. It appears that there is no way to prevent this because apparently System.in is not null by default and you cannot test if the readers can read without calling the reading methods and catching exceptions (which is the way it currently behaves).
As suggested in this StackOverflow answer the method InputStream.available() could be used at the start to detect if System.in is usable. If the .jar is not started from command line, then this method throws the exception as well. In this case a warning or an info message could be logged (including the exception?) and only the GUI input could be used.
- is duplicated by
-
MC-35609 Server console handler/ERROR
- Resolved
-
MC-36342 Only i Can Join My Server
- Resolved
-
MC-36590 Server - java.io.IOException
- Resolved
-
MC-36668 Server not loading properties
- Resolved
-
MC-36697 Java error on server startup
- Resolved
-
MC-36752 Error On Server Startup
- Resolved
-
MC-40131 Server console handler/ERROR]: Exception handling console input
- Resolved
-
MC-40430 java.io.IOException on SMP
- Resolved
-
MC-41017 Minecraft 1.7.2 SERVER bug/error
- Resolved
-
MC-41834 Other people unable to connect to server.
- Resolved
-
MC-42478 Minecraft 1.7.4 server issue
- Resolved
-
MC-45729 Server console handler/ERROR
- Resolved
-
MC-49648 [Server console handler/ERROR]: Exception handling console input java.io.IOException: The handle is invalid
- Resolved
-
MC-51713 Starting server error for new servers
- Resolved
-
MC-55725 help
- Resolved
-
MC-55830 Multiplayer mode does not work
- Resolved
-
MC-56620 Server displays Invalid Handle error in server logs - can't join
- Resolved
-
MC-64977 Snapshot server not working
- Resolved
-
MC-77320 Minecraft server 1.8.1.exe Giving - java.io.FileInputStream.readBytes(Native Method)
- Resolved
-
MC-78860 My Server Console doesn't show anything!
- Resolved
-
MC-79024 Handle is invalid error
- Resolved
-
MC-80811 I am unable to connect to server from outside network
- Resolved
-
MC-88222 Unique server bug I don't think has been solved
- Resolved
-
MC-107292 Minecraft server reads java.io exception with on 1.10.2 server
- Resolved
-
MC-112691 server.jar file crashes when opened
- Resolved
-
MC-120831 Errors in logs when we starting a Vanilla server
- Resolved
-
MC-127318 1.12.2 server not working
- Resolved
-
MC-129135 Getting an error when trying to run a server
- Resolved
-
MC-129220 Can join my server using localhost but no one can join using external IP
- Resolved
-
MC-132936 error on java
- Resolved
-
MC-161861 Server error, Exception handling console input
- Resolved
-
MC-164050 IOException when starting server
- Resolved
-
MC-181765 Error and Multiple Warnings in Java Edition Server
- Resolved
-
MC-183285 Handle is invalid errors and server says "old" inside of minecraft but i am using the right version
- Resolved
-
MC-248289 The server console occasionally logs "Exception handling console input java.io.IOException: The handle is invalid" when first starting up servers
- Resolved
-
MC-265846 [Server console handler/ERROR]: Exception handling console input
- Resolved
-
MC-277217 1.21.1 Server Exception errors
- Resolved
-
MC-278072 I cannot joing my own server, and no one can
- Resolved
- relates to
-
MC-32850 Server GUI Text box is empty (.exe only)
- Resolved