- Affected version
- 2.3.10
If a user deletes a large number of individual posts in a sufficiently long thread, there is a race for
This is because
Ideally the
This race condition probably applies to a post being hard-deleted as well.
xf_thread.reply_count being set to the actual correct value. This can result in the thread being "broken" where position numbers are re-used.This is because
Thread::postRemoved() acts on the existing loaded Thread object when adjusting reply_count, and not the actual database record. Ideally the
xf_thread record needs to be locked at the start of the update and the actual database value pushed into the thread entity and then adjusted. Switching to SQL for atomically incrementing/decrementing reply_count is another solution, and then updating the in-memory entity similar to how alert counts are handled.This race condition probably applies to a post being hard-deleted as well.
Last edited: