There are 11 updates, 2 comments.
 
 
XWiki Platform / cid:jira-generated-image-avatar-4d5501cf-47e5-4edf-b53b-d20c853c123b XWIKI-22807 Open

Livedata REST result have inconsistent results when called concurrently

 
View issue   ยท   Add comment
 

11 updates

 
cid:jira-generated-image-avatar-f6808c1d-b47e-40fd-86e9-285edd0de35a Changes by Manuel Leduc on 22/Jan/25 17:38
 
Summary: Livedata REST result have inconsitant result inconsistent results when called currently concurrently
Fix Version: 17.0.0
Fix Version: 16.10.3
Version: 12.10
Version: 16.10.1
Version: 16.4.6
Documentation in Release Notes: N/A
Documentation: N/A
Description: It seem that sometime when we call the livedata rest API we don't have a consistent result when we do some call currently concurrently .

We can see the consequence
by , for example on this issue: https://jira.xwiki.org/browse/BVERSION-106

It's not an easy bug to reproduce manually, I was able to reproduce it but it happen randomly, not in all case.

So to have a better way to reproduce this issue I made this following bash script:
{code:java}
for ((i=0; i<10; i++)); do
    (
        versionClassNb=$(curl -s -u Admin:admin 'http://localhost:8080/xwiki/rest/liveData/sources/liveTable/entries?sourceParams.className=XWiki.XWikiUsers'  -H 'Accept: application/json, text/javascript, */*; q=0.01' | jq .count)
        sleep 0.2
        echo "Number of users: $versionClassNb"
    ) &
    proc1Nb=$!

    (
        pageStatusClassNb=$(curl -s -u Admin:admin 'http://localhost:8080/xwiki/rest/liveData/sources/liveTable/entries?sourceParams.className=XWiki.XWikiRights' -H 'Accept: application/json, text/javascript, */*; q=0.01' | jq .count)
        sleep 0.3
        echo "Number of rights $pageStatusClassNb"
    ) &
    proc2Nb=$!

    wait $proc1Nb
    wait $proc2Nb

done
{code}
When I run this script on a clean xwiki instance on 16.10.1 I've this result:
{code:java}
Number of users: 1
Number of rights 1
Number of users: 3
Number of rights 3
Number of users: 1
Number of rights 1
Number of users: 1
Number of rights 1
Number of users: 3
Number of rights 3
Number of users: 3
Number of rights 3
Number of users: 3
Number of rights 3
Number of users: 1
Number of rights 1
Number of users: 1
Number of rights 3
Number of users: 1
Number of rights 1
{code}
Normally we expect that we have always:
{code:java}
Number of users: 1
Number of rights 3
{code}
Assignee: Manuel Leduc
Pull Request Status: Awaiting Committer feedback
 
 

2 comments

 
cid:jira-generated-image-avatar-f6808c1d-b47e-40fd-86e9-285edd0de35a Manuel Leduc on 22/Jan/25 17:38
 

Further analysis

here this.uriInfo is a field on the singleton class  DefaultLiveDataEntriesResource which gets this field from XWikiResource

Since DefaultLiveDataEntriesResource is a singleton, the fields is overridden when concurrent threads are running

 
cid:jira-generated-image-avatar-f6808c1d-b47e-40fd-86e9-285edd0de35a Manuel Leduc on 22/Jan/25 17:47
 

https://github.com/xwiki/xwiki-platform/pull/3825