This issue has been created
There are 4 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-171a314e-6ff0-453b-9a99-8a602c614cd6 XWIKI-25291 Open

Acquiring a document lock fails when the lock is removed concurrently

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-665d18bb-960e-42b6-a635-cb243fac88ff Marius Dumitru Florea created this issue on 14/Oct/26 12:14
 
Summary: Acquiring a document lock fails when the lock is removed concurrently
Issue Type: cid:jira-generated-image-avatar-171a314e-6ff0-453b-9a99-8a602c614cd6 Bug
Affects Versions: 1.0 B1
Assignee: Unassigned
Components: Old Core
Created: 14/Oct/26 12:14
Priority: cid:jira-generated-image-static-major-5ea6eec8-db79-4110-a1cb-6ade79ebcad8 Major
Reporter: Marius Dumitru Florea
Description:

Symptom

A request to lock a page can fail, leaving the page unlocked, when the same page is being unlocked at the same time. Nobody is told about it: the lock request answers with an error that the browser ignores, so the user believes the page is locked while other users can start editing it without being warned.

This happens, for instance, when navigating between administration sections: leaving a section unlocks XWiki.XWikiPreferences while the section being opened locks it again, in two concurrent requests.

WARN  c.x.x.w.XWikiAction - Uncaught exception [.../bin/lock/XWiki/XWikiPreferences?ajax=1&action=admin]
com.xpn.xwiki.XWikiException: Error number 13007 in 3: Exception while loading lock
    at XWikiHibernateStore.loadLock
    at XWikiDocument.getLock
    at LockAction.action(LockAction.java:56)
Caused by: org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xpn.xwiki.doc.XWikiLock#...]

Cause

XWikiHibernateStore#loadLock first checks that a lock row exists for the document, then loads it with a second statement. When the transaction isolation level is READ COMMITTED, each statement sees the latest committed data, so if an unlock commits between the two statements the load fails.

READ COMMITTED has always been the default isolation level of PostgreSQL and Oracle. Since XWIKI-24997 it is also the default for MySQL and MariaDB, which made the failure visible there.

Reproduction

On MySQL (default configuration), a stress test that replays concurrently the requests sent when switching between two administration sections hit this 3 times in 300 rounds, always on the page that is unlocked and locked at the same time.

 
 

4 updates

 
cid:jira-generated-image-avatar-665d18bb-960e-42b6-a635-cb243fac88ff Changes by Marius Dumitru Florea on 14/Oct/26 12:14
 
Fix Version: 17.10.14
Fix Version: 18.9.0-rc-1
Fix Version: 18.4.7
Assignee: Marius Dumitru Florea