Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash involving Frost Walker + OPAC. #538

Open
Vaelzan opened this issue Aug 21, 2024 · 9 comments
Open

Crash involving Frost Walker + OPAC. #538

Vaelzan opened this issue Aug 21, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@Vaelzan
Copy link

Vaelzan commented Aug 21, 2024

I've just been sent this crash report by one of our players. I hadn't seen it before today so I'm not sure how they ended up in this state. Unfortunately I can't get them to try with the latest version of OPAC right now, but looking at the latest source code here in the repo it seems like there might still be a fix that can be made.

https://bytebin.lucko.me/gIvsGSpsNX

I have no idea how FROSTWALK_ENTITY ended up nonnull but FROSTWALK_LEVEL is null. That seems weird to me since they appear to be both set at the same time on consecutive lines. It looks like the crash is happening during one of the Ensorcellation mod's events, but I haven't had a chance to look into why that's happening.

Is it worth adding a null safety check on FROSTWALK_LEVEL here?

if(FROSTWALK_ENTITY == null || FROSTWALK_LEVEL.getServer() == null || !FROSTWALK_LEVEL.getServer().isSameThread())

ie. changing line 573 from if(FROSTWALK_ENTITY == null || FROSTWALK_LEVEL.getServer() == null || !FROSTWALK_LEVEL.getServer().isSameThread())

to if(FROSTWALK_ENTITY == null || FROSTWALK_LEVEL == null || FROSTWALK_LEVEL.getServer() == null || !FROSTWALK_LEVEL.getServer().isSameThread())

@thexaero
Copy link
Owner

It's not possible for FROSTWALK_ENTITY to be nonnull while FROSTWALK_LEVEL is null. A null level would cause a crash in preFrostWalkHandle before ever setting the entity.
I'm not sure if it was in the older version that they are using.

@thexaero
Copy link
Owner

Looks like it wasn't possible back then too. This is a strange one. I don't think a null check would even fully help because it's basically null-checked as is.

@Vaelzan
Copy link
Author

Vaelzan commented Aug 21, 2024

It's not possible for FROSTWALK_ENTITY to be nonnull while FROSTWALK_LEVEL is null. A null level would cause a crash in preFrostWalkHandle before ever setting the entity. I'm not sure if it was in the older version that they are using.

I mean that's literally what the stacktrace says is going on isn't it? I don't think I'm reading it wrong. Looking at the same section of code from that period of time via the commit history it doesn't look like it has changed since then either.

@thexaero
Copy link
Owner

Alright, I think I see what's happening. The crash is happening on the client side. It's a race condition with the server thread. I'll have to make sure preBlockStateFetchOnFrostwalk only runs on the server thread.

@thexaero thexaero added the bug Something isn't working label Aug 21, 2024
@thexaero
Copy link
Owner

Not sure if it's a compatibility issue or fully on my end, but I'm leaning towards a compatibility issue with ensorcellation.

@Vaelzan
Copy link
Author

Vaelzan commented Aug 21, 2024

@thexaero
Copy link
Owner

Thanks! Yeah, probably related. Either way though, I was definitely intending to catch non-server-thread calls and didn't do it right.

@Vaelzan
Copy link
Author

Vaelzan commented Aug 21, 2024

Heh, of course when things that are meant to be impossible happen it's because of multithreading. Almost every time. :)

I had a feeling it might have been something like that; the player who reported it to me mentioned that it wasn't consistently crashing, just occasionally (as well as no other players ever mentioning such a crash). For now they're happy enough just using a different enchant to avoid it.

Thanks for taking a look!

@thexaero
Copy link
Owner

The issue should only affect integrated servers (mostly singleplayer) and occur very rarely. I'll try to find time to fix it ASAP though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants