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 due to MixinBlockColors #71

Closed
maxanier opened this issue Nov 6, 2021 · 4 comments
Closed

Crash due to MixinBlockColors #71

maxanier opened this issue Nov 6, 2021 · 4 comments

Comments

@maxanier
Copy link

maxanier commented Nov 6, 2021

There is/used to be a crash with Magnesium/Sodium Reforged.

This was reported to this spoorn/sodium-forge here: spoorn/sodium-forge#63 and fixed in that repository: spoorn/sodium-forge@701eb80

In this repository however, the fix is not applied: https://github.com/Someone-Else-Was-Taken/Periodic-Table-Reforged/blob/beaa6b747a0a846dfddf993395b17dc83139db9a/Legacy%20Sodium/src/main/java/me/jellysquid/mods/sodium/mixin/core/model/MixinBlockColors.java

For me it is unclear from what sources the Magnesium releases from on CurseForge are built.
However, it seems like they trigger the same bug.

Exception message: java.lang.ArrayIndexOutOfBoundsException: 1024
Stacktrace:
	at it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap.rehash(Reference2ReferenceOpenHashMap.java:908) ~[fastutil-8.2.1.jar:?] {re:classloading}
	at it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap.insert(Reference2ReferenceOpenHashMap.java:273) ~[fastutil-8.2.1.jar:?] {re:classloading}
	at it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap.put(Reference2ReferenceOpenHashMap.java:281) ~[fastutil-8.2.1.jar:?] {re:classloading}
	at net.minecraft.client.renderer.color.BlockColors.handler$baa000$preRegisterColor(BlockColors.java:532) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.client.renderer.color.BlockColors.func_186722_a(BlockColors.java) ~[?:?] {re:mixin,pl:runtimedistcleaner:A,re:classloading,pl:mixin:A,pl:runtimedistcleaner:A}

Full crashreport:
crash-2021-11-05_11.52.37-fml.txt

@nthxny
Copy link

nthxny commented Nov 7, 2021

tf is Vampirism doing that this not being thread safe is causing you to crash? Simple fix ig but there are many mods using BlockColors that do not crash this way

@maxanier
Copy link
Author

maxanier commented Nov 7, 2021

Just registering colors: https://github.com/TeamLapen/Vampirism/blob/6178a71869ba8964f8d87e4b6396ada353ebb2e3/src/main/java/de/teamlapen/vampirism/client/core/ModBlocksRender.java#L32
On second thought that should probably be done on the main thread not during the ParallelDispatch LoadComplete event.
Yet for some reason this issue only occurred with Sodium/Magnesium installed.

I am mainly wondering if the magnesium releases on curseforge are built from the Legacy-Sodium folder in this repository or if the spoorn repository is involved somehow

@nthxny
Copy link

nthxny commented Nov 7, 2021

It seems Sodium is expecting the Block colors method to be called from the main thread, which AFAIK is correct, but its an easy fix on either end regardless. It likely didn't arise because no mod was doing thread-unsafe operations on the HEAD and TAIL of the method you're calling.

Pretty sure this repo was ported from Fabric Sodium independently of other ports, hence the lack of this fix. It's definitely not using spoorn's code on the curse builds.

@maxanier
Copy link
Author

maxanier commented Nov 7, 2021

Alright, I have fixed that on our side. I just did not really investigate the issue itself before, because I did not know what Sodium/Magnesium is doing and it was fixed in the other repo anyway. Sorry about that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants