News for hackers. Stuff that matters.
Re:Reddit's photo albums broke due to Integer overflow of Si... by manigandham on Tuesday December 13, 2022 @07:03PM (#33978134)
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?

Re:Reddit's photo albums broke due to Integer overflow of Si... by andreareina on Tuesday December 13, 2022 @08:28PM (#33978845)
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

Re:Reddit's photo albums broke due to Integer overflow of Si... by manigandham on Wednesday December 14, 2022 @01:07AM (#33980537)
That doesn't change anything... it's still round robin. You just stopped at an arbitrary number of 8 integers instead of 9.
Re:Reddit's photo albums broke due to Integer overflow of Si... by lofatdairy on Wednesday December 14, 2022 @01:57AM (#33980803)
It's not arbitrary, GP stated it was a 3 bit counter. In GGP (or something, not sure how far down in the thread we are), they were referring to a 32 bit int counter until overflow. If you bin each number from 0 to 2^32 - 1 by mod 3, you don't get 3 bins of equal sizes, 1 bin always comes out smaller.
Re:Reddit's photo albums broke due to Integer overflow of Si... by manigandham on Wednesday December 14, 2022 @02:17AM (#33980907)
Smaller by a single number at most, it's effectively insignificant. Not sure where the 3-bit counter assumption came from as the original post said 32bit signed int.
Re:Reddit's photo albums broke due to Integer overflow of Si... by CyberDildonics on Tuesday December 13, 2022 @08:43PM (#33978974)
while C only once

You listed C twice

Re:Reddit's photo albums broke due to Integer overflow of Si... by woodruffw on Tuesday December 13, 2022 @09:00PM (#33979099)
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 Si... by manigandham on Wednesday December 14, 2022 @01:10AM (#33980553)
There's no ratio. It's even across all of them, as long as the integer keeps incrementing. One more number (9) instead of stopping at 8 and there would be an even spread.
Re:Reddit's photo albums broke due to Integer overflow of Si... by ahmedtd on Wednesday December 14, 2022 @01:54AM (#33980785)
Not when the counter overflows back to 0. If it's a 3 bit counter, 0 is A again, not C.
Re:Reddit's photo albums broke due to Integer overflow of Si... by manigandham on Wednesday December 14, 2022 @02:12AM (#33980880)
The comment says a 32-bit signed int. Where is the 3-bit assumption coming from?
Re:Reddit's photo albums broke due to Integer overflow of Si... by iforgotpassword on Wednesday December 14, 2022 @02:28AM (#33980955)
The comment starts with that assumption for the sake of a concise example. do you expect them to write the whole sequence out using a 32bit counter? :-D
Re:Reddit's photo albums broke due to Integer overflow of Si... by manigandham on Wednesday December 14, 2022 @03:19AM (#33981200)
Then it's irrelevant. The point is that the remainders are evenly distributed as the integer is incremented, with at most a single round being short. That's just how the math works.
Re:Reddit's photo albums broke due to Integer overflow of Si... by iainmerrick on Wednesday December 14, 2022 @03:44AM (#33981338)
"A single round being short" is exactly what they're talking about.

Edit to add: whether that's a big enough effect for the use case they're talking about, I don't know. This sort of thing is definitely significant in cryptographic code, though.

Re:Reddit's photo albums broke due to Integer overflow of Si... by Thorrez on Wednesday December 14, 2022 @03:23AM (#33981231)
When you divide 2^32 across 3 machines, you get 1431655766, 1431655765, 1431655765. They're nearly identical, just an itsy bitsy bit different. This isn't going to cause one machine to have noticeably less load than the others.
Re:Reddit's photo albums broke due to Integer overflow of Si... by iforgotpassword on Thursday December 15, 2022 @08:18AM (#33999065)
That's not what's being discussed here though.
Re:Reddit's photo albums broke due to Integer overflow of Si... by Thorrez on Thursday December 15, 2022 @12:54PM (#34003143)
Then what is being discussed? I thought this thread was about 3 servers, of which one has lower load due to an int32 overflowing.
Re:Reddit's photo albums broke due to Integer overflow of Si... by andreareina on Tuesday December 13, 2022 @10:27PM (#33979671)
Edited, thanks