Problem/Motivation
We have a race condition in \Drupal\content_lock\ContentLock\ContentLock::locking() because the select and merge are separate queries.
Proposed resolution
Either use the lock service to wrap the select and merge in a lock or maybe code to do a merge without a select and then catch the failures when the lock exists already.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork content_lock-3441549
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
alexpottWe can't do the merge idea because merge is implemented as a select and update or insert... so yet another opportunity for races... so we can consider using upsert or using the lock system.
Comment #4
alexpottComment #5
smustgrave commentedWasn't sure how to trigger the lock but applying the MR on the site we are using on and locks still appear to be working just fine. So going to lean on that.
Comment #6
alexpottI've tried to write a test for this - both low level and and high level - using pcntl_fork() to simultaneously lock via the API and UI neither worked because it is hard to have multiple sessions as the same time in FunctionalTests and separate service instances in kernel tests.
Comment #7
alexpottComment #9
alexpott