When the “Accept Solution” button is clicked simultaniously by two members a topic may get two solutions.
AI-generated summary
A concurrency issue was discovered in the “Accept Solution” feature, where two users clicking the button simultaneously could result in a topic having two accepted solutions. nikod reported the issue and provided steps to reproduce it, which involved synchronizing clicks with a friend to test. After some attempts, nikod was able to reproduce the issue and shared a screenshot of the result. pfaffman asked if the issue had occurred naturally, and nikod confirmed that it had.
A fix was quickly implemented by zogstrip, who added a mutex to resolve the concurrency issue. The fix was commended by pfaffman and nikod for its speed and effectiveness.
Hello @nikod, it has been a while ![]()
Can you share a screen recording of this or some detailed steps to reproduce?
Steps to reproduce:
- Open a topic in two browsers logged in as two different users.
- Click the “Accept Solution” of two different posts in both windows as fast as possible.
Cool. That sounds like a lot of effort that makes it highly unlikely to occur, but still something. Could you do this and record your screen to help us confirm?
I had to synchronize clicking with a friend and we had to try four time until we could reproduce … so I don’t have a screencast, just screenshot of the result:
Steps to reproduce:
- Have two people open a topic logged in as two different users.
- No solution has been accepted for this topic before.
- Synchronize (for example counting down) clicking the “Accept Solution” of two different posts.
- Reload the page to see the real result.
- With some “luck” two solutions will be accepted.
I don’t know if it’s possible with the same account. I don’t know if it’s possible if any solution has been accepted before.
Also I’m really sorry but we’re running v2.4.0.beta2 +123.
Once I find the time to run the update I can try to reproduce again.
Did this actually happen in the wild or only when you try really, really hard?
It did. (0123456789)
Added a mutex that should fix the concurrency issue
https://github.com/discourse/discourse-solved/commit/9ecac7a3e25de655f34657748da23ec1b6f107ed
That’s some pretty great sleuthing!
And a darn fast fix! Thanks! ![]()
This topic was automatically closed after 25 hours. New replies are no longer allowed.
