-
Notifications
You must be signed in to change notification settings - Fork 397
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
Fix ItemStack.EMPTY.getItem() rarely returning null due to threading #2826
Conversation
Does this happen in vanilla? |
I used I also checked the inlining log (with FYI this is what I used to run the tests: Not perfect, but seems OK at a glance. |
Does this not hurt other items set to count 0 because they won't return null but a wrong value, which is less severe? I personally recommend patching the instance field write/reads to local variables or mark the method synchronized for a more comprehensive solution. |
We could overwrite the method to |
Changed to an overwrite. Using a cancellable injector because of lithium's mixin: https://github.com/CaffeineMC/lithium-fabric/blob/1.19.x/dev/src/main/java/me/jellysquid/mods/lithium/mixin/item/ItemStackMixin.java that will conflict with any sort of |
For the bug I've reported to mojang, I was able to reproduce this bug in vanilla after several hours, you can see the crash log here. https://bugs.mojang.com/browse/MC-258939 |
Thats awesome! Thanks 👍 |
Wow. We theorized and joked about this potentially being a vanilla bug. To have it confirmed is another story. Have hunted this issue for over 6 months, so finally putting it to rest is great. |
Tech told me he didn't think this was a vanilla bug so I had to prove him wrong |
See for example AztechMC/Modern-Industrialization#404.