Skip to content
  • Leigh B Stoller's avatar
    Moral of this commit; cross-database locking sucks. · 824f535f
    Leigh B Stoller authored
    The deadlock problems appears to be caused by ExtendSlice(). We were not
    locking `geni-cm`.geni_slices when doing the BeginTransaction(), and the
    deadlock was caused by MaxSwapIn() getting that table locked after the
    BeginTransaction but before the call to SetExpiration().
    
    OK, so that should have caused a DB error and notification starting
    years ago. I originally thought it was some kind of weird mysql bug, but
    as it turns out, the abstraction of geni slices as a package and its DB
    interface, meant that the table was being updated via a different
    connection to mysql. So after I added the lock of the table, it
    immediately hit the lock taken by the DB connection to tbdb. So, I
    juggled some deck chairs around and came up with a not too pretty
    solution that locks the table in the DB connection to tbdb, and updates
    geni_slices via that same connection.
    
    Lets see what happens!
    824f535f