Paper
Paper copied to clipboard
Server crashed with unexcepted stacktrace if address/port in used
Stack trace
https://paste.gg/p/anonymous/e140028727d94fccbc01c15f9d1daec4
Plugin and Datapack List
Clean install without any plugin or datapack or worlds.
Actions to reproduce (if known)
Start a clean Minecraft server instance on 25565. Start another clean Minecraft server instance on 25565. You got it!
Paper version
Server crashed before accept command.
#142 - Paper 1.19.2 https://github.com/PaperMC/Paper/commit/ef0e5a642d33ac62f070c45a61cb42647b2744cd
Other
In old Paper builds, Paper will exit without create a crash-report.
After update to latest (#142 - ef0e5a) build, paper will create a exception and crash-report before exit.
Something on your system is already using the port your server is attempting to run on. The server obviously cannot start.
Something on your system is already using the port your server is attempting to run on. The server obviously cannot start.
No, see the other section:
In old Paper builds, Paper will exit without create a crash-report.
After update to latest (https://github.com/PaperMC/Paper/issues/142 - ef0e5a) build, paper will create a exception and crash-report before exit.
So this issue is about the stacktrace created when the server is shutting down due to a port already bound ?
So this issue is about the stacktrace created when the server is shutting down due to a port already bound ?
yes
updated title for better explanation
Thank you.
I'll reopen this for now, tho at least in my opinion this has a very low priority. The logs clearly state the issue here. If you feel like it, you can submit a PR to fix this issue (a rather straight forward null check for that matter), otherwise I'll leave the issue on low priority for someone to potentially fix in the future.
Sorry again for not completely understanding your exact issue here, the title change certainly specified your issue better.
This has been the case for a long while, the only difference now is that vanilla moved their crash reporting logic somewhere in 1.19.x that now it will generate a crash report as opposed to just being logged; The handling of the bind failure should probably be improved, but, not particularly a bug to be cared about
I decided to fix this, but I'm not sure it should be fixed? There are actually two exceptions, both of which get logged. Fixing one with a null check is easy enough, but the IllegalStateException is still logged.
In MinecraftServer.java:
protected void runServer() {
try {
long serverStartTime = Util.getNanos(); // Paper
if (!this.initServer()) {
throw new IllegalStateException("Failed to initialize server");
}
Obviously this can be fixed with
if (throwable instanceof IllegalStateException) {
return;
}
in the catch statement before the crash report is generated, but that seems like it could catch things that ought to be logged.
I realize this is a very insignificant bug and I'm probably overthinking this, but I'm trying to get the hang of the code base. Going for low hanging fruit seems like a good start.
Since this is a vanilla change, the only issue to care about is the NPE not the illegal state exception.
The general headache is that now that mojang is harder at generating the crash report, people run towards that rather than just looking at the logs. Part of the Q here is do we try to move the more obvious error so that it shows up inside of the crash report
Can no longer reproduce the NPE happening on 1.20.4