Expected Behavior
Multiple concurrent patches to the same record, from different processes, should result in at least one patch failing with a 412 error (Precondition Failed)
Minimal example will be submitted via a P/R test case shortly.
Actual Behavior
If multiple patch requests are both processed at the same time in different processes, multiple conflicting patches will succeed with a 200, resulting in data inconsistency.
Environment
Discussion
Prior to commit 54fd697 from 2016-November, ETags would be verified
twice during a patch. One ETag check would be non-atomic by Eve,
then again atomically by MongoDB during app.data.update(filter).
The atomic ETag check was removed during issue #920 in 54fd697
When running Eve in a scale-out environment (multiple processes),
concurrent simultaneous updates are sometimes allowed, because
the Python-only ETag check is not atomic.
There is a critical section in patch_internal() between get_document()
and app.data.update() where a competing Eve process can change the
document and ETag.
I am working on a pull request that contains a proposed patch and a simple
test case that simulates this situation and will upload it shortly.
Thank you.
Chuck Turco
Expected Behavior
Multiple concurrent patches to the same record, from different processes, should result in at least one patch failing with a 412 error (Precondition Failed)
Minimal example will be submitted via a P/R test case shortly.
Actual Behavior
If multiple patch requests are both processed at the same time in different processes, multiple conflicting patches will succeed with a 200, resulting in data inconsistency.
Environment
Discussion
Prior to commit 54fd697 from 2016-November, ETags would be verified
twice during a patch. One ETag check would be non-atomic by Eve,
then again atomically by MongoDB during app.data.update(filter).
The atomic ETag check was removed during issue #920 in 54fd697
When running Eve in a scale-out environment (multiple processes),
concurrent simultaneous updates are sometimes allowed, because
the Python-only ETag check is not atomic.
There is a critical section in patch_internal() between get_document()
and app.data.update() where a competing Eve process can change the
document and ETag.
I am working on a pull request that contains a proposed patch and a simple
test case that simulates this situation and will upload it shortly.
Thank you.
Chuck Turco