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

Future Fix SQL Error When Following User

Discussion in 'Future-Fix Bug Reports' started by digitalpoint, Aug 13, 2013.

  1. digitalpoint

    digitalpoint Well-Known Member

    It's really rare (maybe like once every few days), but I see duplicate entry errors show up in our server log once in awhile when someone tries to follow someone.

    Not really sure how to replicate it... I've tried double clicking follow really fast, etc. and I know there's code that checks if they are already following before it tries to follow them, but for whatever reason there's a case where that check fails when it shouldn't somehow.

    We aren't using any custom database adapter, no master/slave setup, no custom datawriters or models that would affect it.

    Maybe a good idea for it to be an INSERT IGNORE in this case?

    Eagle, Xon, semprot and 5 others like this.
  2. Jeremy P

    Jeremy P Well-Known Member

    I get these showing too every once in awhile.
    digitalpoint likes this.
  3. Mike

    Mike XenForo Developer Staff Member

    It's generally a race condition.

    As we're using the datawriter here, it's not trivial to flip to an insert ignore. This isn't something I'd want to do as part of 1.2 as it changes APIs a bit, but it may be an option to choose an insert/update ignore in the DW and detect it in the save (stopping post save/returning false). I think we might need to explicitly opt into it as it could make the insert fail even without any errors after preSave() (unless we then log it as a duplicate record error).
  4. digitalpoint

    digitalpoint Well-Known Member

    The ability for datawriters to support ignore and on duplicate key update is something I've always wished we could do with a flag of some sort. Would be nice to see it in the future...
    Xon, Adam Howard, ZeWildGuy and 5 others like this.
  5. Jaxel

    Jaxel Well-Known Member

    Has this ever been added?
  6. ForestForTrees

    ForestForTrees Well-Known Member

    Holy crap, this happened to me earlier today.
  7. Chris D

    Chris D XenForo Developer Staff Member

    If it happens, it should be rare and generally won't be a huge issue.

    As it stands, this bug is still planned as a "Future Fix".
    tyteen4a03 and ForestForTrees like this.

Share This Page