You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
π Bug Report: Concurrent staging bypasses the transaction operation limit and loses acknowledged operationsΒ #14332
Create a transaction (default limit: 100 operations, APP_LIMIT_DATABASE_TRANSACTION; on Cloud databasesTransactionSize per plan).
Send 8 POST /v1/tablesdb/transactions/{id}/operations requests at the same time, each with 60 create operations.
Commit.
B β lost operations
Create a transaction and stage one operation.
Send the commit and, at the same time, 6 more staging requests with one create each.
Check which staged rows exist after the commit.
π Expected behavior
A: at most 100 operations are accepted; the requests that would exceed the limit get 400 transaction_limit_exceeded.
B: every staging request that returns 201 is applied by the commit, or the request fails because the transaction is no longer pending.
π Actual Behavior
A: all 8 requests return 201, the transaction counts 480 operations, and the commit applies all 480 rows (4 of 4 rounds). Sequential staging is limited correctly (101st operation β 400).
B: in 2 Γ 20 rounds, 109 and 112 staging requests returned 201; 106 and 103 of them were never applied, and their logs stay behind. The commit returns 200. A client that does not await each staging call before committing (e.g. Promise.all over staging plus commit) silently loses writes it was told succeeded. When the commit is already running, staging is refused correctly (400, status committing).
Cause: Transactions/Operations/Create.php checks the status (L100βL102) and the operation count (L110βL118) on a plain read, and writes the logs and increments the counter later (L258βL266) without locking the transaction row or bounding the increment. The commit claims the transaction atomically since #14163 and then reads the logs, so logs written after that read are never applied.
π² Appwrite version
2.4.0
π» Operating system
Linux (Debian 12), Docker
π§± Your Environment
Self-hosted Appwrite 2.4.0, Postgres adapter, two API nodes (requests spread over both).
π‘ Suggested fix
Do the check and the write in one database transaction that locks the transaction row, as the commit claim does: getDocument('transactions', $id, forUpdate: true), re-check status === 'pending', expiry and operations + count <= max, then insert the logs and increment the counter.
π Have you spent some time to check if this issue has been raised before?
Activity