Live data from Hacker News

Chess.com stopped working on 32bit iPads because 2^31 games have been played

chess.com

141–150 of 338 posts

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#141

Earlier quoted context omitted.

We can help you understand how and why! Computers set limits internally on how big numbers can be when they're keeping track of stuff. Your developers had given each game a number to identify it. So your first game was #1, the 40th game was #40, and so on. The limit for how big the number could be was a bit over 2 billion, and your players have just now played a bit over 2 billion games, and so that id number suddenl…

Yes - I understand HOW it happened, just not sure WHY. Meaning, I'm not sure what the developer was thinking, and at this point, I'm not going to track down exactly who it was and point fingers. I think everyone has learned enough through this highly interesting bug. It certainly was interesting to see the slack room exploding with theories and debugging. A new iOS client has been submitted to Apple (hurry plz!!!), a…

> Meaning, I'm not sure what the developer was thinking

A 32bit integer is pretty much the default numeric type for the majority of programming tasks over the last 20 years. Even with 64bit CPUs, 32bit is still a common practice. Probably 99% of all programmers would make the same choice unless given specific requirements to support more than 2 billion values.

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#142
post #56

Earlier quoted context omitted.

> I sometimes think it would've been better if a few things had visibly failed in January 2000. Having to spend billions of dollars on programmers' goofy means of saving a few bytes of memory is a pretty visible failure.

Nope. Definitely not goofy. My dad was a programmer in the early days. The machines he started on in the 1960s had 8 KB of RAM. Saving a byte then is the equivalent today of saving 1 MB on an 8 GB machine. Multiply that times, say, the thousands of customer orders you're trying to process and the goofy thing would be burning a lot of additional RAM because it might help somebody 35 years later. Who among us is writin…

[deleted]

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#143
post #129

Earlier quoted context omitted.

I think it was sarcasm

Sarcasm is recursive.

Yours is the first comment in this chain that I can say pretty confidently isn't sarcasm. So it kind of breaks the chain, making the sarcasm in this chain non-recursive. Which means maybe you were being sarcastic after all? Actually I don't even know if my own comment is sarcasm or not.

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#144
post #50

So they probably just need to use longs instead of ints. But I'm curious, if you were really stuck with a 32-bit limit on data types, what's your preferred workaround? I'm thinking I'd add another field that represents a partition. Are there other "tricks"?

If you could only use 32-bit data types, you can get 64-bits from using 2 integers together like a long number. So the right integer would hit the max, start over at 0, and increment the left integer. Then, using this idea you can create a class of numbers that can have however many bits you want by using more ints.

Cool, yeah, that's what I meant by partitioning, which I guess is more of a database term.

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#145
post #46

Earlier quoted context omitted.

Similar to how much effort goes into dealing with things like dangerous strains of bird flu, only to have people complain about how much money was spent on "nothing" when an outbreak doesn't occur.

This is a whole class of problem - I wonder if there's a name for it. More examples include: talking about welfare being unnecessary because no one is starving. Or people on medications stopping because they feel better (while still on them).

This reminds me of an essential but overlooked truth examined in this paper: "Nobody Ever Gets Credit for Fixing Problems that Never Happened". It builds a simple system dynamics model and shows the long-term effects of working smarter versus working harder: http://web.mit.edu/nelsonr/www/Repenning=Sterman_CMR_su01_.p...

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#146
post #92
post #55

I recently experienced a nasty bug with BLOB in MySQL. The software vendor was storing a giant json which contained the entire config in a single cell. It ran fine for months, and then when it was restarted it totally broke. Reason was: the json had been truncated the entire time in the database, so it was gone forever. It was only working because it used the config stored in memory on the local system. Nasty!

Mysql's unix_timestamp() breaks on years past mid 2038...so plan for that one too.

OpenBSD[1]:

> time_t is now 64 bits on all platforms.

Linux[2]:

> The vast majority of 64-bit hosts use 64-bit time_t. This includes GNU/Linux, the BSDs, HP-UX, Microsoft Windows, Solaris, and probably others. There are one or two holdouts (Tru64 comes to mind) but they're a clear minority.

This is little help for older, already deployed systems, of course.

[1]: https://www.openbsd.org/55.html

[2]: https://mm.icann.org/pipermail/tz/2004-June/012483.html

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#147
post #99
post #8

Self-confidence as a programmer is when starting a new project, storing the transaction ID as a long rather than an int...

The naive, 9 years in the past me once was like "int will last us forever! and it'll save us some space!", only to have to change it to bigint a few months later

"int will last us forever! and it'll save us some space!",

There are still plenty of people with that mindset. Some will even quote "YAGNI" when you question them.

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#148
post #56

Earlier quoted context omitted.

> I sometimes think it would've been better if a few things had visibly failed in January 2000. Having to spend billions of dollars on programmers' goofy means of saving a few bytes of memory is a pretty visible failure.

Nope. Definitely not goofy. My dad was a programmer in the early days. The machines he started on in the 1960s had 8 KB of RAM. Saving a byte then is the equivalent today of saving 1 MB on an 8 GB machine. Multiply that times, say, the thousands of customer orders you're trying to process and the goofy thing would be burning a lot of additional RAM because it might help somebody 35 years later. Who among us is writin…

But a 2 digit date should take less than 7 bits. Were they using systems that didn't use 8 bit bytes? Why wouldn't the dates work from, say 1900 to 2155?

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#149
post #89
post #55

I recently experienced a nasty bug with BLOB in MySQL. The software vendor was storing a giant json which contained the entire config in a single cell. It ran fine for months, and then when it was restarted it totally broke. Reason was: the json had been truncated the entire time in the database, so it was gone forever. It was only working because it used the config stored in memory on the local system. Nasty!

MySQL's silent data truncation is such a nuisance. It's off by default in 5.7, and can be disabled in earlier versions by adding STRICT_ALL_TABLES/STRICT_TRANS_TABLES to sql_mode [1]. I inherited a system where, among other things, the entire response body from a payment gateway callback is saved into a text field using utf8 character set, despite the fact that most of the supported payment gateways send data in iso-…

> MySQL's silent data truncation is such a nuisance.

Yes, yes it is - it burned me so badly (catastrophic, unrecoverable production data loss) in the early days of my career (~15 years ago as a junior level dev in a senior level role) that it has forever colored my opinion of MySQL - I will really never trust it again.

Long live PostgreSQL!

Re: Chess.com stopped working on 32bit iPads because 2^31 games have been played

#150
post #55

I recently experienced a nasty bug with BLOB in MySQL. The software vendor was storing a giant json which contained the entire config in a single cell. It ran fine for months, and then when it was restarted it totally broke. Reason was: the json had been truncated the entire time in the database, so it was gone forever. It was only working because it used the config stored in memory on the local system. Nasty!

For those, like my, that didn't recall off the top of their heads: BLOB in MySQL can usually only hold ~64KB. EDIT: Though I am curious why MySQL doesn't throw an error when you try to store more than 64KB in BLOB?

It'll give a warning. Many/most MySQL drivers won't interpret it as an error, though.
Post reply on HN