Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

The reputation displayed in my profile and on were the same for quite a while already - the changes to the reputation system worked out well. Still, something went wrong today. First I noticed that the indicator on the "reputation" tab mentioned 15 points reputation increase when I really gained 25 points:



I then checked the total reputation and there is a 10 points mismatch here as well:



I guess that triggering a reputation recalc will fix this - but this still might be a bug worth looking into. Unfortunately, I have no idea what triggered it. From what I can tell, it was an absolutely normal upvote that didn't get counted for some reason.

Edit: I'm pretty certain that my total reputation was 15434 this morning - my network profile however claims that it was 15424. So maybe the issue is with the 10 points I received yesterday, the display in the network profile doesn't show them for some reason.

share|improve this question
The network profile is only synced once every 24 hours. It is not live. – Oded May 4 '12 at 10:54
@Oded: I know. Which is why I point out the mismatch for yesterday's reputation (the network profile is synced at 1 AM local time). – Wladimir Palant May 4 '12 at 10:55
@Oded: That's synced relatively constantly, it's done via the aggregator that relays every rep change up to a central database via redis messaging. SE may cache for a while on top of querying that database, but nowhere near a day. – Nick Craver May 4 '12 at 11:03
Its caching. Its always caching. Unless its a race condition. – Won't May 4 '12 at 14:48
up vote 9 down vote accepted

This happens because of how Linq2SQL works, and it really, really sucks but there's little we can do about it without a major overhaul (getting off Linq2SQL for this, which we have considered, and continue to). So here's how it goes:

Let's assume you're at 100 rep before this happens, to keep it simple.

  • OP upvotes your answer, request sent to the server, in progress...
  • OP accepts your answer, request sent to server, in progress...
  • Upvote request gets your user object (100 reputation)...
  • Accept vote request gets your user object (100 reputation)...
  • Upvote passes through logic/checks, etc, determines you get 10 points... 110 reputation
  • Accept vote passes through similar logic, determines you get 15 points... 115 reputation RUH ROH
  • Upvote saves, in the form of Update Users Set Reputation = 110 Where UserId = @Id
  • Accept vote saves, in the form of Update Users Set Reputation = 115 Where UserId = @Id
  • You now have 115, not 125. see where the problem is here. Since Linq does a = and we can't make Linq2SQL do a Reputation = Reputation + @delta format...last save wins in this kind of race.

The good news is that the reputation history view that tracks every change does not suffer this problem...since it's just inserting 2 rows (in there your summation of rep is what it should be). This allows us to compared, detect and fix up these race results every night, so there's a job to do that until we go nuts and rewrite how rep is saved (it would touch a lot of code).

share|improve this answer
So the answer is don't accept immediately after upvoting (and vice versa). :) – ChrisF May 4 '12 at 11:06
Ok, so there is a classical race condition and I simply didn't see it on this site before. Thank you for the detailed explanation. I made sure to put a little wait between upvoting and accepting your answer :) – Wladimir Palant May 4 '12 at 12:25
@WladimirPalant - yup it is a rare one (may happen on different web servers, etc), but has to happen very fast...we only see about 20-50 of these a day total last I looked a week ago. – Nick Craver May 4 '12 at 12:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .