Fixed Setting mutliple nodes to "Private" causes unpredicatble results, errors

Kent

Active member
Reproduce: attempt to set multiple nodes to "Private" at the same time. This takes longer on servers with more content, so I wasn't able to reproduce it in a test environment without addons.

The result was nodes that displayed as set to private in the admincp while actually being accessible by anyone. Setting a node to or from private fixes this by rebuilding permissions properly.

This might affect other areas as well, seems to be that one of the previous pages' actions completed after the more recent actions. Easy enough to just wait for pages to finish loading, but might be an issue with multiple admins working at the same time.

Code:
Server Error

Mysqli statement execute error : Duplicate entry '0-0-node-47-general-viewNode' for key 'user_group_id_unique'

    Zend_Db_Statement_Mysqli->_execute() in Zend/Db/Statement.php at line 297
    Zend_Db_Statement->execute() in Zend/Db/Adapter/Abstract.php at line 479
    Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 574
    Zend_Db_Adapter_Abstract->insert() in XenForo/DataWriter.php at line 1591
    XenForo_DataWriter->_insert() in XenForo/DataWriter.php at line 1580
    XenForo_DataWriter->_save() in XenForo/DataWriter.php at line 1381
    XenForo_DataWriter->save() in XenForo/Model/Permission.php at line 1140
    XenForo_Model_Permission->_updatePermissionsForUserCollection() in XenForo/Model/Permission.php at line 1061
    XenForo_Model_Permission->updateContentPermissionsForUserCollection() in XenForo/ControllerAdmin/Permission/Node.php at line 257
    XenForo_ControllerAdmin_Permission_Node->_setPermissionRevokeStatus() in XenForo/ControllerAdmin/Permission/Node.php at line 76
    XenForo_ControllerAdmin_Permission_Node->actionNodeWideRevoke() in XenForo/FrontController.php at line 310
    XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
    XenForo_FrontController->run() in /var/www/[...]/admin.php at line 13
 
There is a race condition here (which is what caused that DB error) but it's a pretty significant edge case so I'm not going to focus on it. I can sort of theoretically see how the permission cache ended up broken, but it shouldn't be because of that DB error. That happens before any cache rebuilding.

I think I just need to lock the permission tables for writes when updating.
 
I experienced this right now, I have 200+ Forum nodes, and 20+ Hidden section.
Error in database connection, also error in admin page.
Repairing the database, fixed it.
But no error on logs after repair.
Any quick fix on this?
Even if file edits, I will apply if possible to temporarily fix this.
 
I, too, have experienced something similar. Didn't get the error, but there was unauthorized access to a private forum by someone who didn't have permission.
 
Back
Top Bottom