enonic / xp

Enonic XP
https://enonic.com
GNU General Public License v3.0
198 stars 34 forks source link

Race in NodeStorageService.store #10448

Open rymsha opened 4 months ago

rymsha commented 4 months ago

It may theoretically happen in

nodeServvice.checkExists <- return false for thread 1 and 2
versionIndex.store
branchIndex.store 
<-------------------- thread 2 overtakes thread 1
searchIndex.store

in this case branchIndex will have data for thread 2 (last write wins) but searchIndex will have data for thread 1

If nodes are different (data, path, permissions, etc) it is a big problem. For entirely equal nodes search index will have wrong nodeVersion Id (it is called _versionkey in search index) and maybe timestamp (_ts).