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

Race Condition: ArrayIndexOutOfBoundsException for ForgeZetaEventBus#unsubscribeMethod #52

Open
ByThePowerOfScience opened this issue Nov 10, 2024 · 0 comments

Comments

@ByThePowerOfScience
Copy link

Environment: Forge 1.20.1
Zeta: 1.0-24
Quark: Quark-4.0-460

Failed to create mod instance. ModID: quark, class org.violetmoon.quark.base.Quark
java.lang.ArrayIndexOutOfBoundsException: Index 353 out of bounds for length 0
	at net.minecraftforge.eventbus.ListenerList.unregister(ListenerList.java:133) ~[eventbus-6.0.5.jar%2352!/:?]
	at net.minecraftforge.eventbus.ListenerList.unregisterAll(ListenerList.java:140) ~[eventbus-6.0.5.jar%2352!/:?]
	at net.minecraftforge.eventbus.EventBus.unregister(EventBus.java:290) ~[eventbus-6.0.5.jar%2352!/:?]
	at org.violetmoon.zetaimplforge.event.ForgeZetaEventBus.unsubscribeMethod(ForgeZetaEventBus.java:94) ~[Zeta-1.0-24.jar%23756!/:1.0-24]

This happens inconsistently whenever my modpack is loaded. It seems like something isn't synchronized in the event bus, causing a race check to be possible under the right circumstances. I haven't used it much, but you might be able to just wrap the call in a synchronized block to fix it.

Full Stacktrace
[10Nov2024 00:33:51.019] [modloading-worker-0/ERROR] [net.minecraftforge.fml.javafmlmod.FMLModContainer/LOADING]: Failed to create mod instance. ModID: quark, class org.violetmoon.quark.base.Quark
java.lang.ArrayIndexOutOfBoundsException: Index 353 out of bounds for length 0
	at net.minecraftforge.eventbus.ListenerList.unregister(ListenerList.java:133) ~[eventbus-6.0.5.jar%2352!/:?]
	at net.minecraftforge.eventbus.ListenerList.unregisterAll(ListenerList.java:140) ~[eventbus-6.0.5.jar%2352!/:?]
	at net.minecraftforge.eventbus.EventBus.unregister(EventBus.java:290) ~[eventbus-6.0.5.jar%2352!/:?]
	at org.violetmoon.zetaimplforge.event.ForgeZetaEventBus.unsubscribeMethod(ForgeZetaEventBus.java:94) ~[Zeta-1.0-24.jar%23756!/:1.0-24]
	at org.violetmoon.zeta.event.bus.ZetaEventBus.lambda$unsubscribe$1(ZetaEventBus.java:83) ~[Zeta-1.0-24.jar%23756!/:1.0-24]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[?:?]
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992) ~[?:?]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?]
	at org.violetmoon.zeta.event.bus.ZetaEventBus.unsubscribe(ZetaEventBus.java:83) ~[Zeta-1.0-24.jar%23756!/:1.0-24]
	at org.violetmoon.zeta.module.ZetaModule.setEnabledAndManageSubscriptions(ZetaModule.java:53) ~[Zeta-1.0-24.jar%23756!/:1.0-24]
	at org.violetmoon.zeta.module.ZetaModule.setEnabled(ZetaModule.java:42) ~[Zeta-1.0-24.jar%23756!/:1.0-24]
	at org.violetmoon.zeta.config.ConfigManager.setModuleEnabled(ConfigManager.java:165) ~[Zeta-1.0-24.jar%23756!/:1.0-24]
	at org.violetmoon.zeta.config.ConfigManager.lambda$new$10(ConfigManager.java:116) ~[Zeta-1.0-24.jar%23756!/:1.0-24]
	at java.util.HashMap.forEach(HashMap.java:1421) ~[?:?]
	at org.violetmoon.zeta.config.ConfigManager.lambda$new$12(ConfigManager.java:115) ~[Zeta-1.0-24.jar%23756!/:1.0-24]
	at org.violetmoon.zeta.config.ConfigManager.lambda$onReload$13(ConfigManager.java:180) ~[Zeta-1.0-24.jar%23756!/:1.0-24]
	at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?]
	at org.violetmoon.zeta.config.ConfigManager.onReload(ConfigManager.java:180) ~[Zeta-1.0-24.jar%23756!/:1.0-24]
	at org.violetmoon.zeta.Zeta.loadModules(Zeta.java:142) ~[Zeta-1.0-24.jar%23756!/:1.0-24]
	at org.violetmoon.quark.base.proxy.CommonProxy.start(CommonProxy.java:82) ~[Quark-4.0-460.jar%23659!/:4.0-460]
	at org.violetmoon.quark.base.Quark.<init>(Quark.java:55) ~[Quark-4.0-460.jar%23659!/:4.0-460]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
	at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) ~[?:?]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:481) ~[?:?]
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:70) ~[javafmllanguage-1.20.1-47.3.0.jar%23761!/:?]
	at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:124) ~[fmlcore-1.20.1-47.3.0.jar%23760!/:?]
	at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?]
	at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?]
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?]
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?]
	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?]
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?]
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?]
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

1 participant