Concurrency problem: Two solutions for the same topic

When the “Accept Solution” button is clicked simultaniously by two members a topic may get two solutions.

2 Likes

Hello @nikod, it has been a while :slight_smile:

Can you share a screen recording of this or some detailed steps to reproduce?

1 Like

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. :frowning: 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?

2 Likes

It did. (0123456789)

2 Likes

Added a mutex that should fix the concurrency issue

https://github.com/discourse/discourse-solved/commit/9ecac7a3e25de655f34657748da23ec1b6f107ed

11 Likes

That’s some pretty great sleuthing!

2 Likes

And a darn fast fix! Thanks! :+1:

2 Likes

This topic was automatically closed after 25 hours. New replies are no longer allowed.