StackOverflow error at HashMap (pipe)
LadyCailinBot opened this issue ยท 13 comments
CRAFTBOOK-3322 - Reported by Enatras
My console log is spammed with the following trace:
[Server thread/ERROR]: Could not pass event SourcedBlockRedstoneEvent to CraftBook v3.9-SNAPSHOT-jenkins-CraftBook-146
java.lang.StackOverflowError
at java.util.HashMap.putVal(HashMap.java:641) ~[?:1.8.0_72-internal]
at java.util.HashMap.put(HashMap.java:611) ~[?:1.8.0_72-internal]
at java.util.HashSet.add(HashSet.java:219) ~[?:1.8.0_72-internal]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:149) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
at com.sk89q.craftbook.mechanics.pipe.Pipes.searchNearbyPipes(Pipes.java:172) ~[?:?]
And so on and so on...
What to do? :(
Comment by me4502
Could you please try with the latest build? it outputs at what point it fails. This'll help me work out when I should make it delay.
Comment by Enatras
Yes, I'm going to update asap and will report the results to you.
Comment by Enatras
Installed build 154 but no StackOverflow so far... I'm waiting for it to happen because I was unable to reproduce.
Comment by Enatras
This occured at a depth of: 1355
This occured at a depth of: 1231
Comment by me4502
So I can't make pipes of that length work perfectly, but I've made the error get silenced when it does occur. I've also made the warning hidden behind an option, so if you want to see where the large pipes are you can get the error.
If you do want to support massive pipes, you could try increasing the Java stack size through the -Xss option. Eg, -Xss4M
Comment by Enatras
Thanks, I'm giving it a try with 4M. Thanks for your helpful support :)
Comment by me4502
Could you please provide a screenshot of the pipes? Either you've got pipes that are thousands of blocks long, without any IC or anything in between... Or you've managed to find an infinite loop issue.
Comment by Enatras
Hey,
Because we have hundreds of pipes on our server and the trace does not give any information about the location, I'm not able to locate the (maybe) long pipe and give you a screenshot. Is there any other way to get some informations about the location?
I was flying and teleporting from player to player but there are too many possibilities...
Comment by me4502
Try this build, instead of spamming the error - it'll put a warning in the console saying a stack overflow occured at the following location.
Comment by Enatras
Stupid players...
http://i.imgur.com/9yJX8sM.png
http://i.imgur.com/Nxf27wk.png
http://i.imgur.com/CSs7JEc.png
http://i.imgur.com/xMYG93E.png
http://i.imgur.com/KlS7Vr0.png
How to prevent something like that? Is there a "limit pipes to" option? If not, is it possible to add it?
Comment by me4502
Wow, that's a big pipe...
So I can add an option to limit pipes to a certain queue depth. There's also the possibility of adding a delay once it hits a certain depth, as that'll reset the stack size.
Not sure if that'd have any side effects though.