CraftBook 3

CraftBook 3

139k Downloads

SelfTriggerThinkEvent runs into StackOverflow

LadyCailinBot opened this issue ยท 11 comments

commented

CRAFTBOOK-2864 - Reported by TheE

I updated to devBuild #3579 to see if it could fix the massive memory usage coming from just a few planter ICs. However, just after the startup is finished, The console gets spammed with an error message from the SelfTriggeredThinkEvent that apparently runs into a StackOverflow:

[20:24:27] [Server thread/ERROR]: Could not pass event SelfTriggerThinkEvent to CraftBook v3.8-SNAPSHOT:3579-5267476,master
org.bukkit.event.EventException
	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:320) ~[spigot.jar:git-Spigot-1280]
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-1280]
	at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredListener.java:30) ~[spigot.jar:git-Spigot-1280]
	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:482) [spigot.jar:git-Spigot-1280]
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:467) [spigot.jar:git-Spigot-1280]
	at com.sk89q.craftbook.common.st.SelfTriggeringManager.think(SelfTriggeringManager.java:101) [CraftBook.jar:3.8-SNAPSHOT]
	at com.sk89q.craftbook.common.st.MechanicClock.run(MechanicClock.java:26) [CraftBook.jar:3.8-SNAPSHOT]
	at org.bukkit.craftbukkit.v1_7_R1.scheduler.CraftTask.run(CraftTask.java:58) [spigot.jar:git-Spigot-1280]
	at org.bukkit.craftbukkit.v1_7_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:345) [spigot.jar:git-Spigot-1280]
	at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:612) [spigot.jar:git-Spigot-1280]
	at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:273) [spigot.jar:git-Spigot-1280]
	at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:560) [spigot.jar:git-Spigot-1280]
	at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:467) [spigot.jar:git-Spigot-1280]
	at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [spigot.jar:git-Spigot-1280]
Caused by: java.lang.StackOverflowError
	at sun.security.provider.SHA.implCompress(SHA.java:122) ~[?:1.7.0_25]
	at sun.security.provider.SHA.implDigest(SHA.java:103) ~[?:1.7.0_25]
	at sun.security.provider.DigestBase.engineDigest(DigestBase.java:186) ~[?:1.7.0_25]
	at sun.security.provider.DigestBase.engineDigest(DigestBase.java:165) ~[?:1.7.0_25]
	at java.security.MessageDigest$Delegate.engineDigest(MessageDigest.java:576) ~[?:1.7.0_25]
	at java.security.MessageDigest.digest(MessageDigest.java:353) ~[?:1.7.0_25]
	at sun.security.provider.SecureRandom.engineNextBytes(SecureRandom.java:226) ~[?:1.7.0_25]
	at java.security.SecureRandom.nextBytes(SecureRandom.java:455) ~[?:1.7.0_25]
	at java.security.SecureRandom.next(SecureRandom.java:477) ~[?:1.7.0_25]
	at java.util.Random.nextDouble(Random.java:444) ~[?:1.7.0_25]
	at com.sk89q.craftbook.util.SearchArea.getRandomBlockInArea(SearchArea.java:253) ~[?:?]

The last part is repeated over an over and makes using the server, and even reading in the console completely impossible (therefore I set the priority to Major).

If you need the full server log, see [here|http://paste.ubuntu.com/6828182/].

commented

Comment by me4502

It's one of the farming IC's. It seems its radius is invalid, therefore it can't find a random block

commented

Comment by TheE

Could you implement a validation for radius and offset, right when the IC is loaded? It would be helpful to see an (optional?) warning in the console that displays the IC's coordinates. Right no I have absolutely no idea where the IC that causes this mess can be found.

commented

Comment by me4502

Try the latest build. It doesn't have validation, but it may possible fix the error.

commented

Comment by TheE

Just tested build #3583, did not fix it.

commented

Comment by me4502

Try the latest build.

commented

Comment by TheE

As of build #3589, I get NullPointers instead of the StackOverflow. However they are still thrown each second, so the build is still not usable for me:

[11:54:02 ERROR]: Could not pass event SelfTriggerThinkEvent to CraftBook v3.8-SNAPSHOT:3589-f5e68b0,master
org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:320) ~[spigot.jar:git-Spigot-1280]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-1280]
        at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredListener.java:30) ~[spigot.jar:git-Spigot-1280]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:482) [spigot.jar:git-Spigot-1280]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:467) [spigot.jar:git-Spigot-1280]
        at com.sk89q.craftbook.common.st.SelfTriggeringManager.think(SelfTriggeringManager.java:112) [CraftBook.jar:3.8-SNAPSHOT]
        at com.sk89q.craftbook.common.st.MechanicClock.run(MechanicClock.java:26) [CraftBook.jar:3.8-SNAPSHOT]
        at org.bukkit.craftbukkit.v1_7_R1.scheduler.CraftTask.run(CraftTask.java:58) [spigot.jar:git-Spigot-1280]
        at org.bukkit.craftbukkit.v1_7_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:345) [spigot.jar:git-Spigot-1280]
        at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:612) [spigot.jar:git-Spigot-1280]
        at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:273) [spigot.jar:git-Spigot-1280]
        at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:560) [spigot.jar:git-Spigot-1280]
        at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:467) [spigot.jar:git-Spigot-1280]
        at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [spigot.jar:git-Spigot-1280]
Caused by: java.lang.NullPointerException
        at com.sk89q.craftbook.circuits.gates.world.blocks.BonemealTerraformer.terraform(BonemealTerraformer.java:70) ~[?:?]
        at com.sk89q.craftbook.circuits.gates.world.blocks.BonemealTerraformer.think(BonemealTerraformer.java:63) ~[?:?]
        at com.sk89q.craftbook.circuits.ic.ICMechanic.onThink(ICMechanic.java:291) ~[?:?]
        at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_25]
        at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_25]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:318) ~[spigot.jar:git-Spigot-1280]
        ... 13 more
commented

Comment by me4502

Try latest build.

commented

Comment by TheE

That seems to have fixed it. Thanks for your work.

I still would appreciate if this would be handled smoother in the long. Maybe make the SearchArea throw an InvalidSearchAreaException, catch it in the Manager and unload IC (and optionally log a message)...

commented

Comment by me4502

To be able to do that, first I'd need to work out what is invalid with that particular IC that causes this scenario to occur.

commented

Comment by TheE

True. Let me know if you need any additional informations from my side.

commented

Comment by me4502

If you are able to identify the sign of the IC that had caused those errors, that'd be very helpful. Working out what was on the lines of the sign is the first step to solving it.