Project Red - Exploration

Project Red - Exploration

27M Downloads

Infinite loop in BundledCommons.mostSignificantBit

fnuecke opened this issue ยท 3 comments

commented

The method BundledCommons.mostSignificantBit can get stuck in an infinite loop, specifically in line 112, as found using VisualVM (trace here). If I'm not mistaken, the issue is the use of >>= instead of >>>=, because -1 >> 1 == -1, hence it'll never reach zero.

commented

This method is meant to be used for bundled signals. You can't have a -1 signal, hence the method shouldn't ever be called with a -1 signal. Is that not so?

commented

I've seen a server freeze at this very point (with the trace linked above). Could reproduce reliably when entering the world. I had been sent the world where this happens by someone else, to investigate whether it may be caused by my mod, but I still have it lying around, if you're interested in it?

commented

No, its okay. I added in a simple sanity check in the method. Fixed via 2efa2bb