The Numerical Overflow of the 26th of March, 2014

The Numerical Overflow of the 26th of March, 2014
Post by: SiggiJG - March 27th, 2014, 1:31:17 am

Good Day to all you CubeBuilders out there!

Earlier, at around 4:11 PM (North American EST) 4:11 AM (Hong Kong Time) 6:11 AM (Australian EST), many Minecraft servers crashed due to numerical overflow.

Wait... what? How does a number crash an entire server?

The server calculates the current server "tick" by the number of milliseconds since 1970, divided by 50, so we have 20 ticks per second. One tick is one use of the CPU, and then the server goes to sleep until the next tick, and then the process repeats over and over.

If you took the current number of milliseconds that has elapsed since January 1st, 1970, and divided it by 50 and then tried to stuff it into a 32-bit signed integer, it would overflow to a negative number. This is because the maximum number that can fit inside a 32-bit signed integer is 2147483647. If you have a number larger than that, it would overflow to -2147483648, the minimum number that fits in a 32-bit signed integer. Since the server couldnt handle a negative number, it crashed. Then it restarted, and crashed again. Over and over, until I arrived at my computer to find out the server wasnt working.

To solve this problem, I changed the system, instead of calculating the number of milliseconds since 1970, it would calculate the number of milliseconds since March 27, 2014 at 1:00pm (Hong Kong Time) divided by 50 so that we will have pretty much 44 years until the next crash of this kind. This is a permanent solution until a time that Mojang decides to change the tick system.

Thank you for your patience in waiting for a solution for the server. CubeBuilders is up and running again. Have fun!

Re: The Numerical Overflow of the 26th of March, 2014
Post by: ThunderHoof - June 24th, 2014, 7:57:23 am

I hope the server will be up for 44 years!

Powered by SiggiForum. Copyright © 2018 Siggi.io. Use of this website, and the CubeBuilders game server subject to Terms of Service.  View our Privacy Policy.  CubeBuilders is neither endorsed nor affiliated with Mojang Synergies AB.  "Minecraft" is a trademark of Mojang Synergies AB.  Cookies are stored in your browser by this website for the purposes of improving your experience.  By accessing this website, you consent to the placing of cookies on your system. For information on Cookies, see our Cookies page.