Repository navigation
Description
ArcadeDB Version
26.8.1-SNAPSHOT (build a4834554)
Docker image ID: 7ddb11ca4db3
Digest: arcadedata/arcadedb@sha256:dd4bb8997495abeca132a93b496f9ae4da1120d0e5880867cf879505ab07fa6d
Description
When multiple HTTP clients concurrently execute SET a.counter = a.counter + 1 on the same node, some successfully acknowledged increments are silently lost. The server returns HTTP 200 with a result field and no error/exception, but the final counter value is lower than the number of successful responses. Two requests can even return the same counter value, proving both read an identical stale version.
Steps to Reproduce
See attached repro.py.
Summary: worker threads execute increments via independent HTTP sessions. The query is:
MATCH (a:Cnt {id:1})
SET a.counter = a.counter + 1
RETURN a.counter AS valueA response is only counted as successful if: HTTP 200, result array present with data, no error or exception field in the body. The final counter value is read only after all worker threads have completed.
Expected Behavior
ArcadeDB documents that optimistic-transaction integrity is checked at commit time and that a ConcurrentModificationException is thrown if the record was saved by another transaction in the interim. Therefore, concurrent dependent updates to the same vertex should either preserve every successfully acknowledged increment or report a retryable conflict.
Actual Behavior
All 5 runs show lost updates with zero conflict errors:
High-concurrency (20 threads x 50, 4 runs):
| Run | Successful | Final | Lost | Rate | MVCC conflicts |
|---|---|---|---|---|---|
| 1 | 681 | 666 | 15 | 2.2% | 0 |
| 2 | 666 | 651 | 15 | 2.3% | 0 |
| 3 | 694 | 682 | 12 | 1.7% | 0 |
| 4 | 481 | 470 | 11 | 2.3% | 0 |
Low-concurrency (4 threads x 100):
| Successful | HTTP 503 | Final | Lost | MVCC conflicts |
|---|---|---|---|---|
| 281 | 119 | 280 | 1 | 0 |
Duplicate return values (4-thread run):
Two successful requests returned the same counter value, directly proving both read an identical stale version before writing:
value=50 returned by worker-2/iteration-19 and worker-0/iteration-24
Across all 5 runs: 0 MVCC conflict errors. No HTTP 200 response contained an error or exception field.
Why This Is a Bug
-
Silent data loss. The server acknowledges 281–694 successful responses per run, but increments are missing from the final value. No error or conflict notification.
-
Conflict detection never triggers. ArcadeDB documents that MVCC version conflicts should abort conflicting transactions. None were observed.
-
A single dependent statement.
SET a.counter = a.counter + 1is one Cypher statement where the right-hand side directly depends on the property being updated. Two requests returning the same counter value prove both read the same pre-increment version.
Neo4j Reference
Neo4j 2026.05 Community (also default READ_COMMITTED) tested under identical conditions: 0 lost updates in 3 runs. Neo4j documents that for SET n.prop = n.prop + 1, the Cypher runtime reads the property under a write lock because the expression directly references the property being set, preventing lost updates without requiring SERIALIZABLE isolation.
Workarounds
No equivalent atomic increment or explicit locking mechanism was identified for this Cypher command path. Possible alternatives are:
- Serialize the operation at the application layer;
- Implement compare-and-set/version checking with client-side retry;
- Rewrite the operation as an SQL Script using
COMMIT RETRYor an explicit type/bucket lock (documented in ArcadeDB SQL Script reference).
These workarounds do not prevent an ordinary successful Cypher SET a.counter = a.counter + 1 request from silently losing an update.
Attachments
repro.py— Python reproduction scriptevidence.md— Full evidence with 5-run results, duplicate value analysis, and Neo4j comparison
Activity
fix(#5227): concurrent Cypher SET a.x = a.x + 1 no longer silently lo…
lvca commentedon Jul 11, 2026
Confirmed and fixed on
mainfor the next release.This was a regression: concurrent
SET a.counter = a.counter + 1on the same node could silently lose some increments, because the value on the right-hand side was read from the state loaded byMATCHrather than the record's latest committed state. If another transaction committed in that small window, its update was overwritten with no conflict reported.The fix makes
SETevaluate the right-hand side against the record's current committed value before writing. Concurrent increments now either all apply, or surface a normal retryable conflict that ArcadeDB retries transparently. This keeps the simultaneous-assignment behaviour ofSET a.x = a.y, a.y = a.x(still a swap).Thanks for the clear, reproducible report and the Neo4j comparison; both made this quick to pin down. Please upgrade once the next build is out.
❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
chore(deps): bump swagger.version from 2.2.52 to 2.2.53 [skip ci]
fix(#5227): concurrent Cypher SET a.x = a.x + 1 no longer silently lo…
fix(ArcadeData#6831,ArcadeData#6832): one implementation of the openC…
fix(ArcadeData#8538): MERGE ON MATCH SET no longer loses a concurrent…
fix(#8538): MERGE ON MATCH SET no longer loses a concurrent increment
fix(#11818): conditional UPDATE/DELETE and openCypher SET/REMOVE/DELE…