Live data from Hacker News

Reddit's photo albums broke due to Integer overflow of Signed Int32

old.reddit.com

81–90 of 142 posts

Re: Reddit's photo albums broke due to Integer overflow of Signed Int32

#81

Earlier quoted context omitted.

Thinking "if that ever gets anywhere close to a problem we'll have vast resources and plenty of time to fix it" and then, I'm guessing, that person left a few months later and nobody owned that part of the code because it worked. Then 10 or so years went by... Whenever I write code like that which may break in say, 5 years, I'll sign it in the comments and put my personal email and phone number inviting future people…

Hm. I wonder why no one ever called you.

It's bold. I'm sure if one of those time bombs went off, the call might not be to ask for help, but to impolitely complain.

Re: Reddit's photo albums broke due to Integer overflow of Signed Int32

#82

Earlier quoted context omitted.

If it’s round robin then it should be an even load, how does the modulo change that exactly? Also what number are they using to modulo and where is that happening? Because at that point don’t they already have an incrementing ID before generating another one?

Take a 3-bit counter: 0->A 1->B 2->C 3->A 4->B 5->C 6->A 7->B A and B get hit three times while C only twice, so it will see 66% utilization compared to A and B EDITED s/once/twice/ thanks CyberDildonics

while C only once

You listed C twice

Re: Reddit's photo albums broke due to Integer overflow of Signed Int32

#83
post #9
post #2

Two days ago, Reddit ids have finally incremented passed the 2,147,483,647, or the maximum range of a signed int32. It seems one of Reddit's subsystems, the one that serves its photo albums broke due to the integer overflow.

Strange thing is that photo albums re relatively new. Imgur was the go-to host for Reddit, and then they made their own uploader a looong time later. The "albums" functionality only came out in July of 2020, according to a Google search. Seems this was less likely a "someone else will deal with it" problem, and more of a development / QA testing problem.

A new feature but it wasn’t built on a new codebase. Reddit is a monolith and a lot of things users think of as different “entities” live in the same set of tables.

Re: Reddit's photo albums broke due to Integer overflow of Signed Int32

#84

Earlier quoted context omitted.

Someone probably joked they would never reach that scale when they wrote that code

Thinking "if that ever gets anywhere close to a problem we'll have vast resources and plenty of time to fix it" and then, I'm guessing, that person left a few months later and nobody owned that part of the code because it worked. Then 10 or so years went by... Whenever I write code like that which may break in say, 5 years, I'll sign it in the comments and put my personal email and phone number inviting future people…

Why would you write something that might break in 5 years? Why not just use a 64 bit integer in any situation like this an be done with it?

Re: Reddit's photo albums broke due to Integer overflow of Signed Int32

#85

Earlier quoted context omitted.

Take a 3-bit counter: 0->A 1->B 2->C 3->A 4->B 5->C 6->A 7->B A and B get hit three times while C only twice, so it will see 66% utilization compared to A and B EDITED s/once/twice/ thanks CyberDildonics

while C only once You listed C twice

That's a typo. You can still see they're correct about the ratio (two "C"s for every three "A"s and "B"s).

Re: Reddit's photo albums broke due to Integer overflow of Signed Int32

#86

Earlier quoted context omitted.

I am pretty sure that snowflake didn't use a mod of a signed int32. It used a service discovery pool as part of finagle (and prior to that dns iirc). The server used a very simple method internally to convert time into a integer (that was 52 bits because of javascript). In fact it was completely open source: https://blog.twitter.com/engineering/en_us/a/2010/announcing... The integer generation was pretty simple, ther…

> 52 bits because of javascript But IEEE 754 doubles have a significand that supports a 53-bit range. What am I missing?

negative numbers not used?

Re: Reddit's photo albums broke due to Integer overflow of Signed Int32

#87
post #9
post #2

Two days ago, Reddit ids have finally incremented passed the 2,147,483,647, or the maximum range of a signed int32. It seems one of Reddit's subsystems, the one that serves its photo albums broke due to the integer overflow.

Strange thing is that photo albums re relatively new. Imgur was the go-to host for Reddit, and then they made their own uploader a looong time later. The "albums" functionality only came out in July of 2020, according to a Google search. Seems this was less likely a "someone else will deal with it" problem, and more of a development / QA testing problem.

I’m pretty sure the table in question stores image metadata for all user uploaded images. As well as images scraped from posted links which goes back way before images in posts

Re: Reddit's photo albums broke due to Integer overflow of Signed Int32

#89
post #72

Earlier quoted context omitted.

That isn't disagreeing? It is half the numbers. But that is just minus one exponent. Right?

The GP said it would have "bought Reddit a lot of time," the post I responded to said it was merely 2^31 implying that it wouldn't have bought them a lot of time, that's the part I was replying to (though I didn't word it clearly). 2 billion more values would have bought Reddit a lot of time. I should have taken more time to read over both posts and respond more clearly though

Ah, I read the GP as a correction that it wasn't 2^16, but 2^31 values. The "doubling" was correctly stated, but the edit said they only had 2^16 values to work with. Almost certainly just a mistake in the post.
Post reply on HN