NPE while connecting to server
kreezxil opened this issue · 21 comments
Mod Version:
1.12.2-3.4.9.7
Forge Version:
14.23.2.2624
Link to crash log (if applicable):
https://gist.github.com/kreezxil/a4b4e37914c10ca6277bfd251798deb7
Description:
My player was trying to connect to the server, my other are not having the issue yet but I imagine soon will.
the player in question has been trying to play with 12 year old computer and repeatedly tells me he has has to connect 3 times to finally actually stay in the game. But it is just him that reports that, none of my 100's of players report the issue. Your probably missing a simple null check in one those 4 places. At least i hope it's simple.
And congrats on the big bucks, I'm nipping at your toes, but I have loads more java and forge to learn.
OK - this gives me something to go on. This error is a strange one, and I think it may be related to a tried connect/fail. The order of event bus registrations and object creation should not lead to this issue, so there is something coming in sideways throwing the whole build up/tear down process of the client thread into turmoil.
Essentially:
- Create a global reference to my handler manager and store that.
- Create an intialize all the handlers (EnvironStateHandler is such a handler).
- Register the handlers with Forge event system.
- Register the handler manager with the Forge event system.
What this call stack tells me is that all this creation stuff has happened because the handler manager is what drives the ticking within DS. And it is within that ticking where the EnvironStateHandler comes back to get a reference to the handler manager and it is null. See the first bullet. :\ This may take a bit to tease out what really is going on.
Luckily it is only happening for one person so it is something related to the timing/error handling on his system.
EDIT: Can I get a copy of his client side log with this error? It would give me an idea of the event sequence.
It would be timing related, and it is a real strange one. :\ Right now this shouldn't happen, but it does. This is why I get paid the big bucks. :)
EDIT: Question - you said the player was "trying". Were they having some other sort of difficulty trying to connect when this happened, or was this a normal connect to server and this error popped up? How often does it occur?
Thanks! I made a test jar with some tweaks and additional logging. Can you get him to drop it into his mod folder and test it? If the changes work he should not get a crash. I would like to get a copy of his logs using this JAR, even if there is no crash.
https://github.com/OreCruncher/DynamicSurroundings/releases/tag/1.12.2-3.4.9.8T5
ok, he has the same issue with this version. His updated logs.
If its the same issue the logs don't reflect that. From the logs it appears there are a bunch of connect/disconnects because the server closed the connection. From what you said previous your player has always had connection problems and logs show that. Just how big of a potato is the players computer? It seems like it is struggling to keep up.
Ok, I'm working on it. Maybe I can do something with VirtualBox and simulate a really old computer. I wonder if that is possible.
got his logs, it's a one drive link, https://1drv.ms/u/s!AuyXOq5tWTK7ibh8j4QeHLCG4swpWA
He started in SSP before joining my server. the latest ones, probably last 10 should be all him playing on the server.
I made some changes to the startup sequence of the mod. They will be in the next release posted to CurseForge. It should address situations where the startup timing/sequence is weird.
https://pastebin.com/QaEcSVEh This is the full log.
As for the version, 1.12.2-3.4.9.8
Related but not the same. What appears to be happening is that the client is starting to receive entity capability data for entities because the server detects that player came in range of a mob and it needs to send the initial update. Forge is starting to give me indigestion with startup sequences. :\
@OreCruncher PacketWeatherUpdate.PacketHandler#onMessage needs to schedule a task to perform its duty, the code tries to access the player which may not exist yet since the packets which would do that spawning are in the task queue.
What you point out is a different problem. The Network.postEvent() is the one that figures out what side to queue it on. The problem I see is that EnvironState.getWorld() just above the "if" relies on the player entity which may not be initialized.
EDIT: I'm going to create a new issue for these.
Is this connected to this in any way? I cannot seem to connect to my own server, and I saw this on the client-end logs: