Chess.com Has Stopped Working On 32bit iPads After the Site Hit 2^31 Game Sessions (chess.com) 271
Apple's decision to go all in on 64bit-capable devices, OS and apps has caused some trouble for Chess.com, a popular online website where people go to play chess. Users with a 32bit iPad are unable to play games on the website, according to numerous complaints posted over the weekend and on Monday. Erik, the CEO of Chess.com said in a statement, "Thanks for noticing. 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." Hours later, he had an explanation: The reason that some iOS devices are unable to connect to live chess games is because of a limit in 32bit devices which cannot handle gameIDs above 2,147,483,647. So, literally, once we hit more than 2 billion games, older iOS devices fail to interpret that number! This was obviously an unforeseen bug that was nearly impossible to anticipate and we apologize for the frustration. We are currently working on a fix and should have it resolved within 48 hours.
nearly impossible to anticipate? (Score:5, Insightful)
This was obviously an unforeseen bug that was nearly impossible to anticipate
Only if you're an idiot.
Re:nearly impossible to anticipate? (Score:5, Insightful)
Re: (Score:3)
Re: (Score:2, Funny)
And just wait until they hit 9223372036854775808 games. I bet they'll again say that it was impossible to anticipate.
Missed Opportunity to Highlight Success (Score:5, Interesting)
Failing because you did not anticipate being a huge success makes you look a lot better than just failing because you think it is impossible to foresee overflowing an integer variable.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
LOL
Re: (Score:2)
WORD should be enough for anybody! Pah, who needs DWORD...
32-bit iStuff need dwords, apparently -- a 31 bit word (pointlessly signed) just overflowed.
Unless you mean the Microsoftish way where a "word" is only 1/4 of the actual machine word, that is.
Re: (Score:2)
What the heck is "WORD"?
If you have to ask then maybe you're not as smart as you think you are. Go ahead and tell us about how you don't have a TV, ride a bicycle, and don't eat red meat. That would be about as insightful and hilarious as your comment.
Re: (Score:2)
Here, I'll match a third of that: I don't have a TV.
Re: (Score:2)
Obligatory Answer (Score:2)
Re:Obligatory Answer (Score:5, Insightful)
Re: (Score:2)
As a non-developer I can't really explain how or why this happened seems to apply here as well, that was a ridiculous mistake to make.
Re:Obligatory Answer (Score:4, Insightful)
Re: (Score:2)
How many fewer ad views would the story have gotten without that bit of technical nonsense? Why does /. exist?
Re: (Score:2)
So, easily debunked headlines keep the lights on, but makes everyone's blood pressure go up; which leads to needing a higher required dose of heart meds. This ultimately leads to patrons not coming back, which fails to generate ad revenue in the future.
Proper editing would make me come back more often.
Re: (Score:2, Insightful)
Re:Obligatory Answer (Score:5, Insightful)
https://developer.apple.com/li... [apple.com]
PLEASE mod parent up (Score:2)
A succint summary of issue and resolution. I'd hire you.
long considered harmful (Score:2)
There's almost no reason to use "long". The only non-bogus things I can think of from the top of my head are memcpy implementation, bitwise operations and similar things on a block of memory when you want to handle a word at a time -- where doing it byte-by-byte would work just as well, merely slower.
Either your program needs to handle values >= 2^31/2^32, or it doesn't. In the first case, you use [u]int64_t, in the latter it should be int. Anything else introduces a pointless portability problem: int
Re: long considered harmful (Score:2)
The C standard does not require that [u]int64_t, or any of the other exactly sized types, even exist. So there's one good reason to use int or long.
Re: (Score:2)
It does (C11 7.20.1.1.3) if the implementation supports any 32/64 bit integer types. I can't think of any incoming architecture in foreseable future lacking those. Even if not atomic, the compiler will emulate them. Otherwise, the fraction of our available corpus of software that will work on such an architecture would be uselessly small.
And even there, [u]int_least64_t are required, even in freestanding environment.
Re: (Score:2)
Re: (Score:2)
Bit packing metadata into the game number is short sighted.
And archaic! It's 2017, not 1977!!
Re:nearly impossible to anticipate? (Score:5, Insightful)
Two BILLION chess games?
I'd have not anticipated that a chess site would become that popular. Yes, it's easy to say that it's an obvious bug, but one has to select a variable size during development. Not everything can be stored in a 64 or 128-bit integer, because that would mean a lot of wasted space. So, would YOU have thought it reasonable to use an unsigned 32-bit integer for the number of chess games? I bet many developers would have.
The real problem, though, is no one remembered about that choice once the number of chess games crossed some really obvious threshold, like 1 billion. THAT event should have triggered some developer to think, "holy cow, can we even handle that many? What's the limit? Are we in danger of a Y2K problem?"
But chess games? Two BILLION of them? I'd have thought that would be plenty. Color me very pleasantly surprised.
Re: (Score:3)
Re: (Score:3)
they most likely thought the older 32-bit devices would have fallen out of support and no longer be in use before that happened.
Famous last words since year numbers were encoded as YY to save space. "These systems will be redesigned long before the year 2000!!!!"
Re: (Score:2)
Still a salient example of shortsightedness and selling short one's own work, though. Both of those very common activities are extreme dangers of software development.
Re:nearly impossible to anticipate? (Score:4, Insightful)
Both of those very common activities are extreme dangers of software development.
Because people who have learned the lessons are continuously pushed out to make room for the latest know-it-all hotshots with their hip Comp Sci languages.
Re: (Score:2)
Re: (Score:2, Informative)
Yeah, it's the users' fault for not buying a new iPad every 3 years.
(The last 32 bit iPad was discontinued in October 2014)
Re: (Score:3)
When it does, those of us who leaned more toward the "tested and stable" side will just kick back in our comfy chairs and laugh as we watch the young'ns scramble to put out the fires, just as we did when we were too dumb to prefer stability.
Re: (Score:2)
When it does, those of us who leaned more toward the "tested and stable" side will just kick back in our comfy chairs and laugh as we watch the young'ns scramble to put out the fires, just as we did when we were too dumb to prefer stability.
In fact I just described a former co-worker as "young and stupid" and not in the pejorative sense, but rather as to mean young and inexperienced. It's a place that nearly all of us have been before.
One of my *best* working relationships was with a "fast and loose" coder, while I'm generally the "this branch of code can't happen, I better make sure it's handled just in case it does" type of coder. He'd output a pile of code and I'd end up adding another 100% LoC to it in stability. His overall architectur
Re: (Score:2)
Re:Chess.com (Score:5, Insightful)
This website started in 2005, so unless they saw Nokia brick phones as the way of the future, I really doubt they thought they'd get anywhere close to that many games.
You mean to say they expected to fail before 2 billion games had been played?
Matter of fact, you can blame all (32 and 64) smart phones for this because no one ever seems to close out of their apps.
Why? Does the app continuously play games by itself if you leave it open, thereby artificially inflating the number of games played? No, I don't think it does. And we're talking about the number of games played, ever, not the number of games currently being played, or the number of app instances currently open. Whether people close out their apps or not has absolutely nothing to do with this.
The popular consensus is that most of chess playing traffic comes from old-school Linux users anyway.
Right. So are you saying that their games don't count toward the total number of games played? Because that's what got pushed over 2 billion.
They could just have games close and delete automatically after a period of time.
They could, sure. But, unless they want to deal with data integrity issues, the IDs would continue growing, and it's the ID being too high that is causing the problem. Well, I misspoke there, it's too small of an INT type being used that caused the problem, but that INT is storing the game ID, so it was the ID being too high that revealed the problem.
And, two billion people are never going to be on Chess.com at the same time.
Of course not, but two billion games will eventually have been played, as evident by the fact that this has happened.
But let's say they are, then just use multiple servers.
And the same number of games would have been played, still.
Don't blame the bits for this because the main audience is upgrading anytime soon.
I don't think anybody (except the developer) did this, actually. The fault lies squarely with the developer who used an architecture-dependent INT type rather than forcing a 64-bit INT.
Just keep showing me how much you don't know about things, Hayden. Oh, and good luck in August; let me know if you need a ride.
Re: (Score:2)
2 billion database entries... How many of them qualify as "games" I don't know. Probably very many of them were abandoned, if not immediately then before reaching any kind of conclusion. Maybe some developer was generating a few hundred million for stress testing too.
Re: (Score:2)
Re: (Score:2)
If it took chess.com this long to break 32-bit, then maybe instead of being seen as a success it should be seen as a failure.
Re: (Score:3)
It's actually not that much if you consider their choice of game format.
Consider a game of Bullet Chess, where both players have 1 minute total on their blitz timer and no extra time is added on a move; for example.
Although I agree anyone making a snarky comment that this should have been obvious is just an asshole and probably wouldn't be very fun to work with.
Re: (Score:2)
But chess games? Two BILLION of them? I'd have thought that would be plenty. Color me very pleasantly surprised.
I am not a user of that site, so I'm just speculating here, but I wonder if the games total is so large because a significant number of them are not actually people playing but people using bots to play for analysis purposes. I used to play in official tournaments some years ago and I long ago gave up on chess once computers started getting used for analysis. If you're not a player you might be surprised how much play gets subjected to computer analysis to try to find better outcomes from losses, for exam
Re: (Score:3, Interesting)
No, they are real games by real people. I personally have a bit over 15,000 games played. At this moment (~1PM eastern time on a Tuesday afternoon) there 28,384 players online and 10,158 games currently in progress. The very large majority of those games are 5 minutes or less. Almost all of mine are 2/1 (two minutes per side with a one second inc
Re: (Score:3)
According to their site, 1,958,303 matches have already been played today. I don't know what time zone they're using, but assuming that it's the end of the day for them and that today doesn't deviate from the average, then it only takes around 3 years before hitting that billion game limit.
With t
Re: (Score:2)
Re: (Score:2)
So, would YOU have thought it reasonable to use an unsigned 32-bit integer for the number of chess games? ... Two BILLION of them?
Umm... an unsigned 32 bit integer would allow 4 BILLION (2^32 to be precise) games, not 2 BILLION. They are using a signed 32 bit integer (2^31 - 1).
Re: (Score:2)
$ whois chess.com
Domain Name: CHESS.COM
Creation Date: 11-aug-1994
2 billion / 20 years = 100,000,000. Given that there are ~300M people in just the US alone, if 1/3 of them played 1 game per year, you'd hit that number in a reasonable time. On the one hand, I don't think 1/3 of people play chess; on the other hand, there are several billion people living elsewhere on Earth (I'm told) and I'm sure that many of the people who would bother to sign up to play online would play more than one game per year.
tl;dr 2
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Do you remember the Holocaust?
Re: (Score:2)
Also, this has nothing to do with 64 bit hardware. You can do 64 bit arithmetic on even 8 bit CPUs using sophisticated techniques such as "carry" and "borrow" that are taught in 2nd grade. If you declare a variable as "long long" or "int64_t" the compiler will handle all of that for you.
Re:nearly impossible to anticipate? (Score:5, Informative)
Re:nearly impossible to anticipate? (Score:5, Funny)
Was it days? I remember it taking hours to fix, but my memory is barely 7 bits total these days.
Re: (Score:3)
Re: (Score:3)
I'll take your word for it... Odd that I don't remember the withdrawal symptoms or compulsively pressing F5 every ten seconds. Maybe I've repressed it.
Re: (Score:2)
Araine 5 $7 billion arithmetic overflow...
Re: (Score:2)
Re: (Score:2)
found the story:
https://slashdot.org/story/06/... [slashdot.org]
Re: (Score:2)
I remember it as being when they hit 16777216 (2^24) comments... but yeah, same idea here xD
That story referenced the earlier incident that I was thinking about with the 16-bit field in 2001.
Unfortunately, like 5 years ago we changed our primary keys in the comment table to unsigned int (32 bits, or 4.1 billion) but neglected to change the index that handles parents.
Re: (Score:2)
Re: (Score:2)
Ouch... had never heard about the previous issue (or perhaps I did, maybe 10 years ago)... makes sense now.
Slashdot got bitten by the Y2K bug, albeit not the one that everyone expected.
Re: (Score:2)
I wouldn't have anticipated a Chess site as being that popular. I'd more have expected this to happen to GoKGS or something.
Re: (Score:2)
This was obviously an unforeseen bug that was nearly impossible to anticipate
Only if you're an idiot.
Good to know that my prediction for arrogant hindsight developer comment was confirmed.
Re: (Score:2)
Not hindsight, foresight.
(see reply to anonymous cow herd above).
Though this was hiding in a client app, and for older models of hardware as well. A bit more tricky to see than a database field as the developers will be of the mindset that the integer is 64bits, as it will be on the devices they develop on.
Re: (Score:2)
Anyone remember when Slashdot had similar issue with its comments a few years back...?
All of that for -1 (Score:5, Informative)
The problem could waited twice longer — giving the 32bit iPads time to break down and die of old age on their own — but somebody wasted an entire bit for the possibility to return -1 somewhere...
Any time you pick ssize_t over size_t, for example, you are making the same decision...
Re:All of that for -1 (Score:5, Funny)
Hey, I was born unsigned but my parents had the doctor make me signed by modifying my most significant bit. I can't help but be negative about the whole thing but that's because I'm signed. ;)
Re:All of that for -1 (Score:5, Insightful)
Re: (Score:2)
Careful though, in many languages signed overflow is undefined. C/C++ is like that, for example. In practice it will probably roll to 0x80000000 but it is entirely architecture and compiler dependent if that happens and what 0x80000000 is interpreted as.
Re: (Score:2)
Careful though, in many languages signed overflow is undefined. C/C++ is like that, for example. In practice it will probably roll to 0x80000000 but it is entirely architecture and compiler dependent if that happens and what 0x80000000 is interpreted as.
Nothing like a nitpicker being wrong, 0x7FFFFFFF + 1 might be undefined but 0x80000000 = INT_MIN = -2147483648 is very well defined as long as you approach it from the negative side.
Re: (Score:2)
Careful though, in many languages signed overflow is undefined.
I prefer platform specific behaviour instead of undefined behaviour. Sure, it is bad and should be avoided, but unlike undefined behaviour, platform specific behaviour can't kill your dog (not that you said that, but sometimes I come across such horror stories).
C/C++ is like that, for example. In practice it will probably roll to 0x80000000 but it is entirely architecture and compiler dependent if that happens and what 0x80000000 is interpreted as.
I don't think there are that many possible platform specific overflow outcomes. Throwing exceptions, crashing the application, quietly returning INT_MIN are all preferable outcomes compared to returning 0. At least I am not aware of any platform/lang
Apple's fault? (Score:4, Insightful)
I'm not Apple apologist, but come on why point the finger at Apple? This would have happened on any 32-bit architecture. Blame the devs of the game for not knowing how this works, not Apple.
Re:Apple's fault? (Score:4, Informative)
Exactly. This bug would have happened regardless of Apple's move to 64-bit given that it's a flaw in the site's design that would affect any 32-bit architecture. Apple's move to 64-bit hardware and OSes is the reason newer iPads support the site at all, otherwise the site would be broken across all iPads.
Also, why Chess.com doesn't just switch to unsigned ints and/or migrate to GUIDs is beyond me. You could just map the existing integers to GUIDs and then use GUIDs going forward. 32-bit OSes and CPUs have no problems dealing with 128-bit GUIDs, and it's unlikely that they'd ever encounter this problem again in the next few thousand years.
Re: (Score:2)
It'd be simpler and better for them to just tell affected users that they need to upgrade to the latest Apple iPads.
Re:Apple's fault? (Score:5, Informative)
It has nothing to do with the architecture at all. One can write code that can handle 64 bit values easily on any architecture. Sure it takes a tiny bit more work but people do it all the time.
Re: (Score:2)
Switch to unsigned, get another 2 billion. (Score:2)
Re: (Score:2)
Re:Switch to unsigned, get another 2 billion. (Score:4, Interesting)
Switch to unsigned, get another 2 billion
Might be a fairly short-term fix. Remember Coca Cola's CEO saying "A billion Coca-Colas ago was yesterday morning" and that was 20 years ago.
Russians (Score:5, Funny)
Re: (Score:3)
Maybe it is, indeed, the Russians.
Chess is notoriously popular in Russia, so it is possible that Russians played a large number of these 2^31 games.
"32bit device cant handle IDs above 2,147,483,647" (Score:5, Insightful)
why website is blamed? (Score:2)
Wait what? (Score:3)
Wait.... what? First of all.... you can get TWICE that by using an "unsigned" 32-bit.... since there should never be a negative game ID.
And also what 32-bit machine doesn't have register-combining for 64-bit variables? Just because it isn't representable in a signed 32-bit integer does NOT mean it's 32-bit incompatible...
This explanation makes absolutely no sense to me.
I can guess exactly what happened. (Score:2)
Someone used an int type somewhere in the code whose size is architecture specific. There's no reason a 32-bit iPad couldn't support 64-bit numbers.
I'm confused! (Score:2)
I typed "2,147,483,647 + 1" into my old iPad calculator app and it said 2,147,483,648!
I'm not a programmer, but maybe the answer is to just rewrite your website to use the iPad calculator?!
I hear Apple have sold like, 1 billion of them or something, so you'll be able to use it a billion times two billion at least!
Wait, why is this Apple's fault? (Score:2)
Apple's decision to go all in on 64bit-capable devices, OS and apps has caused some trouble for Chess.com, a popular online website where people go to play chess.
Apple's "64-bit only" decision has nothing to do with this.
Re: (Score:2)
Ridiculous article (Score:5, Informative)
1. Apple hasn't changed everything to 64 bit yet. iOS 11 will only run on 64 bit systems and won't run on any device that is 32 bit only, but this hasn't happened yet.
2. 64 bit applications work just fine. Apparently the application uses 32 bit in the 32 bit version and 64 bit in the 64 bit version, the 32 bit version overflows and the 64 bit version doesn't. So if Apple had killed off all 32 bit versions, which they didn't, everything would have actually been fine.
3. The problem is not 32 bit vs 64 bit application, it is using a 32 bit counter for a quantity that exceeds 32 bits. But 32 bit applications can easily use 64 bit counters. They are just a tiny tiny bit slower, but work just fine.
So the problem has nothing to do with Apple, it is using a 32 bit variable for a 64 bit quantity, in other words, an elementary programming error by the application developer.
Who'd have thunk it? (Score:2)
Math, Ugh! (Score:3)
Re: (Score:2)
Nope, just looks like a bug to me. They may even have a typedef/using, it could be a one liner to fix.
Apple's Fault? (Score:2)
How, exactly, is this Apple's fault? This is a developer programming error based on a lack of understanding how to represent large numbers on systems with limited WORD sizes. Even on the ancient 6502 or Z80 (8 bit processors), we knew how to write code that could handle numbers that far exceed 2^31. And, before they start talking about performance, I need to ask, how many frames per second do you need to render a chess game?
The developers need to place the blame with themselves where it belongs.
Re: (Score:2)
... yes. See the data types directly hardware-supported on the 80386 for example, it supported 64 bit numbers in hardware, and your compiler can emulate that in software if the hardware doesn't directly support it.
https://en.wikipedia.org/wiki/... [wikipedia.org]
It's extremely common for CPUs to support a word size double their "bits", e.g. 8 bit machines generally had a 16-bit integer type, used for addressing 64K of memory.
Re: (Score:2)
In general the advertised word size of a processor is the data size of the general purpose registers and the largest data size that most regular instructions can work on.
The one reasonablly common exception to this is the results of multiplications. Many processors with hardware multipliers have a multiply instruction where the result is double the size of the arguments and stored into two registers.
Larger additions/subtractions/comparisions can be performed by using a carry flag. Larger multiplications can
Re: (Score:2)
It's propably declared as 'Int' which takes the size of the platform is runs on, so on a 32bit platform it will be 32bit, on a 64bit platform it will be 64bit, and so on.. Personally I don't like declarations like that, always just declare it as what you want it to be (int32, int64 or uint32 if you're not gonna go negative, which would have worked in this case too).
Re: (Score:2)
It's not Apple's fault, that's just the journalistic tendency to want to tie all recent events together, even if the connection between them is very weak.
And as you point out, in this case the connection is not only weak, but also described incorrectly, as the 64-bit version of the chess app does not exhibit the problem.
Re: (Score:2)
Re: (Score:2)
I don't know, are you likely to end up with 9,223,372,036,854,775,807 records? As a number, that's probably not too far (relatively speaking) from the number of grains of sand on the Earth.
You could write one record a second for 200 billion years and still not run into a problem.
Re: (Score:2)
You could write one record a second for 200 billion years and still not run into a problem.
But if I manage to sign up 1 billion users and each user produces 1 record per second on average then I break my data base in a mere 200 years. In the age of IoT including body-embedded devices and 99% global connectivity such a data base is actually a possibility. I am sure Facebook, Google, and NSA have all had to ponder this limit already even though they might not have hit it this year or next.