1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Design Issue Pseudo-duplicate messages on reply (rare)

Discussion in 'Resolved Bug Reports' started by Xon, Apr 15, 2016.

  1. Xon

    Xon Well-Known Member

    Rather rarely, I've seen the "more new messages" link after replying to a thread will fetch the just added post. Which results in the same message being appended to the thread twice.

    There is actually only one reply, but it looks like two.

    I suspect this is caused by time-skew inside the VM, since XenForo_ControllerPublic_Thread::_getNewPosts takes a timestamp which can possibly be off by 1, on a second boundary depending on how time sync works, and if the web requests are between nodes.
     
  2. Mike

    Mike XenForo Developer Staff Member

    I'm not really seeing an obvious cause for this, possibly short of race conditions (or more correctly, requests finishing in a different order). The time stamps used here should be the timestamp of elements as they're stored in the database, so I don't think clock differences between servers should directly cause issues, or am I misunderstanding what you're reporting?
     
  3. Xon

    Xon Well-Known Member

    The post's timestamp is taken from XenForo_Application::$time which is set on the start of a request and not when the content is inserted. But yes, requests finishing in a different order would likely explain it.

    My thinking, was the unix timestamp is only accurate to the second so if the clocks where out of sync when one was near a second boundary it might explain the behaviour. But I only did a cursory look into it, last month.

    It would be nice if the DataWriters could actually execute now() on the SQL server itself to populate the default value rather than in code before doing the insert.
     
  4. Mike

    Mike XenForo Developer Staff Member

    I think we may just need to chalk this up to a design issue if it is down to requests returning in a slightly different order.

    On a side note, the time "fixing" is mostly about consistency across a request. As a somewhat random example, calling time() directly (or some other live source) could theoretically lead to a thread creation date being different than the first post. There does need to be a balance and I take the point about time skew between web servers.
     
    Xon likes this.

Share This Page