I am seeing the same issue with duplicated comments as in Bug? Duplicated comment (unresolved), in https://stackoverflow.com/questions/7185857/how-to-what-added-in-sys-path-append but I have some more information which might help to recreate the bug.

There was a comment which I was going to flag as offensive, unfortunately I accidentally clicked upvote and then I didn't seem able to flag it again after that. I went 'back' on the browser and flagged it. Then there appeared a duplicate comment, both of which I appear to have upvoted, but only appearing when I'm signed in. When I log out it's gone, and when I log in again it's back.



By the way, it was slightly annoying to have cast a vote like 'this is a great comment' when I was actually intending to say this is an offensive comment. Could it be possible to undo comment upvotes, like you can with Q and A posts, or at least not remove the vote to flag?

  • 6
    Changing wrong votes on comments is one of the most upvoted status-declined feature-requests that are out there. Please throw another vote on the fire. – Lance Roberts Aug 25 '11 at 7:15
  • 1
    @Lance: I gave it an upvote. I have often wanted to quickly retract a comment vote immediately after clicking the arrow - but alas, not currently possible. – uɐɯsO uɐɥʇɐN Aug 25 '11 at 7:21
  • 4
    Totally reproduced; thanks for the steps. Looking at it. – balpha Aug 25 '11 at 7:47

There were two issues at play here:

  1. The server didn't enforce the "either flag or upvote, not both" rule. While the UI enforces this, there are obivously ways around it – like the one you found.
  2. The code that fetches the comments relied on the fact that the user has only voted (i.e. upvoted or flagged) once. While that's a reasonable assumption, there are edge cases where this may not be true (two I can think off: the one you found, and a connection hickup between the DB server and the web server – the latter is likely what happened in the other case).

Part 1 is fixed by enforcing the rule on the server as well.

Part 2 is fixed by considering this edge case and picking up each comment only once, even if a duplicate vote/flag somehow made it through. As I said, that's very unlikely, but since we cannot enforce this, say, through a UNIQUEness constraint in the database (due to the way the data is stored), it's not impossible. For perspective: Out of close to 9 million comments on Stack Overflow, yours was the fourth where this happened.

(Fix will go out with the next build.)

  • impressive turnaround ! – wim Aug 26 '11 at 5:32

You must log in to answer this question.

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