Live data from Hacker News

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

old.reddit.com

41–50 of 142 posts

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

#41

Nostalgic flashback to Premier Manager games, where players stats decreased as they aged. When they went /below 0/ they flipped around to 127. So a good strategy was to scout out really bad players from lower leagues about to hit age 30+. And offer them very long contracts to prevent them retiring .. and give time for most of their stats to flip around, turning them into superstars.

I always found the funniest occurrence of this was in the Civ game though it seems it originally being a bug is disputed.

https://en.wikipedia.org/wiki/Nuclear_Gandhi

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

#42
post #32

Earlier quoted context omitted.

Awesome to hear from someone on the other side of the API with knowledge of this. This is ringing bells for me. Yeah, the id parameter was how we knew how many servers there were, and we saw more assignment in some servers than others that neatly mapped to a int32 max failing to divide by the number of IDs we saw. I thought I recall Twitter confirming that was how round robin happened but I could be totally misrememb…

I think what your describing was actually a problem that I introduced in our bind configuration back when we used DNS for service discovery. Its not exactly what your describing but I can totally see how it would appear that way externally. So initially we used 2 bind servers with authoritative zones serving using round robin. This worked fairly well as the load on each server was high enough to keep the round robin…

This is awesome and completely retconning a 10 year old project for me. I was working on social media analytics at Disney and we were exploring ways to measure twitter conversation of our brands, which led to us attempting to estimate total conversation volume, which is why this technical nuance was relevant to us. It was a wildly experimental time. Thanks for the story!

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

#43

Earlier quoted context omitted.

To people reading this: please never ever do that, unless it was agreed upon with your client/employer beforehand (and compensated accordingly). If you know the code may break in 5 years, why don't you fix it now? Because your employer doesn't want to pay you to do that (probably for good reason, surely there's higher priorities). Then why would you do it for free years later?

No. You can say, anticipate breaking changes that is calendared to happen as an eventually rollover or deprecation Essentially things have to work one way now and there's solid reason to think it will no longer work that way later and there's no valid path to fix because exogenous conditions change. This alternatively, can be done in bad faith to guarantee a future paycheck by intentionally placing timebombs in and t…

We're not talking about working in bad faith, that's bad obviously. But there's no reason for most people to give away even 2 hours of their time for free. If you're working as a freelancer and it's your way of building a portfolio of clients, that's a good reason to give away those two hours. But I'd rather not have someone with little work experience read that, think it's reasonable, and apply it themselves.

In my first year of university I was working for a very small web company. I got paid per website an amount that was enough for my student needs, nothing much. I wasn't a very good developer in my 1st year, so I often received emails about bugs in past projects. The bugs were my fault, so naturally I fixed them in my own free time.

It took me 2 years to see how badly I was getting owned by the company. If they wanted less bugs, they should have asked someone with experience and a much higher salary.

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

#44
post #3

A long time ago we discovered Twitter used a round robin of three servers for assigning IDs to tweets. We inferred the round robin was done by doing mod 3 of a signed int32, and because that space doesn't divide neatly by two it meant one of the three servers saw less load than the others and we could map ID assignment volume according to how often it overflowed and hence estimate total tweet volume for a given perio…

That's really neat, I'd love to hear more about it. Was this something you were actively trying to find out, or was it poking around until something caught your eye?

A little of both. I was working in social media analytics, and we were collecting everything we could to understand how to communicate the value of this new medium to businesses who could use twitter for marketing. This was still in an era where privacy wasn't at the front of anyone's minds, so there were zero retention policies. Hard to believe that was only 10 years ago.

Eventually, we learned to treat Twitter as a lead generation tool for off-platform activity and apply old school funnel mechanics to it. The next problem became how to build a follower count. Sadly, that problem is what I think led to extremism on the platform. Hence: https://madrox.substack.com/p/yet-another-quitting-twitter

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

#45

Earlier quoted context omitted.

ids being sortable has a lot of advantages over random guids.

This is really a false dichotomy you don't have to use guid/uuid. I'm saying even if you use sortable auto increment numbers, stop storing them like numbers.

Doesn't numeric storage save space and make indexing faster? (This is a naive question, I'm not asserting it.)

Yeah, numbers get you fun stuff like overflows and wrap-arounds, etc. But sorting is faster (sorting "99" before "100" is more complex than 99 before 100) and space requirement is lower (6 bytes can store a unique ID for 281 trillion objects, but 6 characters only permits 1 million if you're storing them as strings).

Or is there some datatype that combines the space- and sort-efficiency of a numeric type, but doesn't bring the baggage of assuming they represent quantities?

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

#46

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…

That's maybe a reasonable thing to do if you're an independent business selling the code, but it's a scab move if you're doing that as an employee. Never work for free.

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

#47

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…

Good practice would be leaving a comment with a TODO, an explanation of the problem, and some basic instructions as to a possible fix.

Leaving your email and phone number is absurd and should not be promoted as good practice. No sane company would take you up on the offer anyway.

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

#48

Earlier quoted context omitted.

ids being sortable has a lot of advantages over random guids.

This is really a false dichotomy you don't have to use guid/uuid. I'm saying even if you use sortable auto increment numbers, stop storing them like numbers.

Note that reddit is currently generating base36 ids starting with z.

You want everything to treat that as text? Sure. That text has been 6 characters long for ages, and it's about to hit 7. I personally expect to see more things break when that happens.

The problem of overflow isn't special to numbers.

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

#49

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…

Oh god, bad memories. You reminded me of a guy I worked with who wrote absolutely terrible, unsafe code and when called out said they are 'caviar problems.'

When I asked what in the hell a caviar problem was, he said it meant by the time we had to worry about those things, we'd all be so rich we'd be eating caviar.

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

#50
post #35

Earlier quoted context omitted.

“32-bit IPv4 addresses to 128-bit IPv6 addresses means going from 4.3 billion to 340,282,366,920,938,463,463,374,607,431,768,211,456” Yes 128 bits is only 4x times the bit length, but the address space is exponentially bigger. Some predict if we do run out, it might take ~100 years.

> Some predict if we do run out, it might take ~100 years. You think we can use 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses in 100 years? Thats ... ahem, ambitious!

In practical terms, IPv6 is arranged as a 64 bit subnet ID and 64 bit device ID.

And the subnets are in a hierarchy that helps with routing but limits the packing efficiency.

We could feasibly "run out" to the point that we can't keep doing things this way.

Post reply on HN