I had two admins (me and another "able-bodied" person) logged in at the same time modifying blocks when all of a sudden all of our blocks that we had enabled (save the default enabled blocks) were disabled and most of the settings (visibility, etc.) were gone.
This is the only time this has happened to me and coincidentally the only time I've had two admins in there at the same exact time.
I looked at _block_rehash() where there is a SELECT, DELETE and INSERT. Is this possible that after I called my DELETE, she called her SELECT (selecting nothing), then after my INSERT, she called her DELETE (deleting my changes), then called her INSERT (inserting nothing)?
Should there be a LOCK TABLES here to prevent this freakishness and make this a db transaction? Also, should we always do a LOCK TABLES when doing this type of SELECT, DELETE, INSERT?
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | block.module.HEAD.patch | 1.77 KB | RobRoy |
| #7 | block.module_17.patch | 1.76 KB | RobRoy |
| #5 | block.module_16.patch | 1.89 KB | RobRoy |
| #2 | block.module_15.patch | 1.83 KB | RobRoy |
Comments
Comment #1
RobRoy commentedchx pointed me to this issue http://drupal.org/node/55516 which deals with a db-independent REPLACE.
Comment #2
RobRoy commentedI think this may fix the critical data loss issue.
@chx Can you confirm this logic?
Comment #3
drummPlease don't abuse the database API and use more normal functions than '_db_query_callback()'
Comment #4
quicksketchConfirmation of this report. I was having a hard time replicating the sudden loss of custom display logic, but I knew the problem originated in _block_rehash since it's the only place where the display logic is modified. Good work on tracking this down.
Comment #5
RobRoy commentedA similar approach is used in devel and views. I guess I was just trying to follow a backport of what was being done in http://drupal.org/node/55516.
But I agree, it is not really needed here. Check out this new patch with a cleaner method.
Comment #6
chx commentedthis is mysql specific code. and yes, it's butt-ugly to begin with.
Comment #7
RobRoy commentedA new patch, hopefully less butt-ugly and MySQL-specific.
Comment #8
RobRoy commentedBumping...IMHO this is a big, big issue and the latest patch is a solid fix that needs to get into DRUPAL-4-7.
If two admins access admin > blocks at perfectly the same time, block settings will be RESET to defaults, clearing all blocks! I'm not talking about two admins saving block settings at the same time, I'm talking about simply accessing the admin/block path at the same time! Imagine this on a production site where two admins are just viewing that blocks page and all the blocks on a live server are removed. Nasty.
Please, can I get holla from the back? :D
Comment #9
killes@www.drop.org commentedlooks ok to me.
Comment #10
m3avrck commentedRan into this problem on a major site with lots of blocks... please commit not only to HEAD but also backport to 4.7 too! Thanks!
Comment #11
RobRoy commentedThe last patch was for DRUPAL-4-7 and this one is for HEAD. Marking this RTBC, but please let me know if that is out of line.
Comment #12
dries commentedCommitted to CVS HEAD. Thanks!
Comment #13
killes@www.drop.org commentedalso to 4.7
Comment #14
(not verified) commented