[ 
https://issues.apache.org/jira/browse/JAMES-3743?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benoit Tellier closed JAMES-3743.
---------------------------------
    Resolution: Fixed

> Mailbox/get failure upon negative quotas
> ----------------------------------------
>
>                 Key: JAMES-3743
>                 URL: https://issues.apache.org/jira/browse/JAMES-3743
>             Project: James Server
>          Issue Type: Improvement
>          Components: JMAP, mailbox
>    Affects Versions: 3.7.0
>            Reporter: Benoit Tellier
>            Assignee: Antoine Duprat
>            Priority: Major
>             Fix For: 3.8.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Spotted on one of my production instances:
> {code:java}
> {  
>   "using": [  ...  ],  
>   "methodCalls": [  
>     [  
>       "Mailbox/get",  
>       {  
>         "accountId": 
> "6cfe53f5858a153a4f70ec455169ccbf9d10d2d47ab75561fc86c75aaf6fcd8a",  
>         "ids": null  
>       },  
>       "0"  
>     ]  
>   ]  
> }
> {code}
> Failed with:
> {code:java}
> {  
>   "sessionState": "2c9f1b12-b35a-43e6-9af2-0106fb53a943",  
>   "methodResponses": [  
>     [  
>       "error",  
>       {  
>         "type": "invalidArguments",  
>         "description": "Left predicate of (!(-53 < 0) && !(-53 > 
> 9007199254740992)) failed: Predicate (-53 < 0) did not fail."  
>       },  
>       "0"  
>     ]  
>   ]  
> }
> {code}
> The message matches the validation error of UnsignedInt class. It backs some 
> types of the returned mailbox response: quota but also counters.
> Further investigations showed this was due to one user quota being negative:
> {code:java}
> linagora@cqlsh> select * from linagora_james.currentquota WHERE quotaroot = 
> '#private&x...@linagora.com';
>  quotaroot                     | messagecount | storage
> -------------------------------+--------------+----------
>  #private&x...@linagora.com |          -46 | 54491982
> {code}
> An attempt to recompute quota failed:
> {code:java}
> curl -XPOST http://127.0.0.1:8000/quota/users?task=RecomputeCurrentQuotas
> {
>   "additionalInformation": {
>     "type": "recompute-current-quotas",
>     "processedQuotaRoots": 219,
>     "failedQuotaRoots": [
>       "#private&x...@linagora.com@linagora.com"
>     ],
>     "runningOptions": {
>       "usersPerSecond": 1
>     },
>     "timestamp": "2022-04-06T05:13:12.462107Z"
>   },
>   "status": "failed",
>   "submittedFrom": "128593e93459",
>   "executedOn": "128593e93459",
>   "cancelledFrom": null,
>   "submitDate": "2022-04-06T05:06:26.916+0000",
>   "taskId": "5199b2b5-570f-4d78-ab14-b0fc0b60cf42",
>   "startedDate": "2022-04-06T05:06:27.024+0000",
>   "failedDate": "2022-04-06T05:13:12.513+0000",
>   "type": "recompute-current-quotas"
> }
> {code}
> We thus had to fix the value to a non negative value before re-running the 
> task.
> h3. Additional notes
> Quota correctness is out of scope for this issue. Cassandra counters are 
> likely poorly suited for the job. Counters are anyway non idempotant 
> entities, which causes correctness issues in the face of retries.
> h3. Expected behaviour
>  -> Recompute quota should not fail on existing negative value.
>  -> Also, the mailbox layer likely should sanitize the values before handing 
> it to upper applicatives layers.
> h3. Definition of done
>  -> Unit test for negative quota recomputation
>  -> Unit test for quota sanitation



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to