Live data from Hacker News

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

chess.com

71–80 of 338 posts

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

#71
post #66

Hey all. Thanks for noticing :P Obviously this is embarrassing and I'm sorry about it. As a non-developer I can't really explain how or why this happened, but I can say that we do our best and are sorry when that falls short. - Erik, CEO, Chess.com

It's an honest mistake, things like this happen. Not the end of the world, especially for an otherwise great product like chess.com. Go easy on your eng team ;)

Thanks. I'm a pretty understanding "boss", especially on the heals of reaching the 2 billion games milestone :D Our team is awesome and we love what we do. Unfortunately we're still a bunch of humans sitting at kitchen counters and on couches around the world, so things do sometimes fall in between the cushions...

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

#72

It's fascinating... the Y2K problem never came to fruition because - arguably - of the immense effort put in behind the scenes by people who understood what might have happened if they hadn't. The end result has been that the entire class of problems is overlooked, because people see it as having been a fuss over nothing. I sometimes think it would've been better if a few things had visibly failed in January 2000.

> 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.

It really depends on how much data and how old.

My dad's first programming job was initially to mechanically change how variables where stored thus saving 1 and only 1 byte of disk space. Someone ran the numbers and having someone do that for a few months was a net savings.

A few years after that he was talking about some relatively minor optimizations that saved a full million dollars worth of hardware costs by delaying a single new computer purchase.

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

#73
post #65
post #52

Earlier quoted context omitted.

When's the last time you worked with an architecture that didn't use twos complement and roll into negatives on overflow? Your reserved bottom range is a perfectly good solution. But rolling into negatives seems fine, too.

C/C++ is notoriously head-ache inducing on this point. Yes, all the CPU archs you'd reasonably expect to encounter today behave this way. However, because the language standard says signed overflow is undefined, compilers are free to assume that it will never happen, and make optimizations that you'd think would be unsafe, but are technically permissible. [1] [1] https://stackoverflow.com/questions/18195715/why-is-un…

Well that's interesting. I was not aware of any compilers doing this. I wonder if there's a switch in gcc/llvm/msvc/etc to turn this specific behavior off.

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

#74

Hey all. Thanks for noticing :P Obviously this is embarrassing and I'm sorry about it. As a non-developer I can't really explain how or why this happened, but I can say that we do our best and are sorry when that falls short. - Erik, CEO, Chess.com

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!!!), and a server fix is also in QA now. Fun problems to have......

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

#75

Hey all. Thanks for noticing :P Obviously this is embarrassing and I'm sorry about it. As a non-developer I can't really explain how or why this happened, but I can say that we do our best and are sorry when that falls short. - Erik, CEO, Chess.com

It's a beautifully simple problem and one born of success.

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

#76
post #60

Hey all. Thanks for noticing :P Obviously this is embarrassing and I'm sorry about it. As a non-developer I can't really explain how or why this happened, but I can say that we do our best and are sorry when that falls short. - Erik, CEO, Chess.com

2 billion is a very large number that was probably not envisioned as reachable in the near future - as a programmer I'd argue this is a pretty easy mistake to make, and that while (slightly) embarrassing, its a good learning moment. It's also really awesome that you're here, and that you guys were so honest about the nature of the bug - this is really something that should be encouraged.

Maybe we should start a blog about all of the interesting bugs and challenges we encounter. It certainly is white-knuckle pretty often when running at scale. The number of devices, connections, features... I'm aging prematurely :P

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

#77
post #26
post #13

Earlier quoted context omitted.

Because signed is default for some reason in most languages, and most developers aren't taught to think critically about how decisions like simple datatypes might affect scalability.

The problem is momentum. I could use unsigned int everywhere, but then I have to constantly typecast to int and back anywhere I use a library expecting signed ints. If we all switched to unsigned int by default, then everything would make more sense but we'll all live in typecasting hell during the migration.

Unsigned by default doesn't make more sense than signed by default. The behavior near 0 is surprising; if you underflow you either get a huge value (anything not Swift) or you crash (Swift).

It was a mistake to use them for sizes in C++. Google code style requires using int64 to count sizes instead of uint32 for good reasons.

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

#78

"This was obviously an unforeseen bug that was nearly impossible to anticipate..." Snarky... Except that there were probably years of games to notice that you were approaching a "magic number" like 2^31.

I actually read that quote as fully sarcastic.

As expected, sarcasm always translates correctly into textual form.

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

#79
post #75

Hey all. Thanks for noticing :P Obviously this is embarrassing and I'm sorry about it. As a non-developer I can't really explain how or why this happened, but I can say that we do our best and are sorry when that falls short. - Erik, CEO, Chess.com

It's a beautifully simple problem and one born of success.

Indeed. I'm not sure that anyone here at Chess.com at the beginning thought we would hit a billion games played in our lifetime. But I guess after 10 years....

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

#80
post #59
post #52

Earlier quoted context omitted.

When's the last time you worked with an architecture that didn't use twos complement and roll into negatives on overflow? Your reserved bottom range is a perfectly good solution. But rolling into negatives seems fine, too.

Signed overflow is ub in C

Signed overflow is IB, not UB.
Post reply on HN