[ https://issues.apache.org/jira/browse/IGNITE-21926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17833936#comment-17833936 ]
Vyacheslav Koptilin commented on IGNITE-21926: ---------------------------------------------- Hi [~yexiaowei] , Could you please share a test that demonstrates the issue? It would be nice to add it to the patch. > The status of GridCacheLockImpl and GridCacheSemaphoreImpl may be inconsistent > ------------------------------------------------------------------------------ > > Key: IGNITE-21926 > URL: https://issues.apache.org/jira/browse/IGNITE-21926 > Project: Ignite > Issue Type: Bug > Components: data structures > Reporter: yexiaowei > Priority: Major > > I noticed that GridCacheLockImpl and GridCacheSemaphoreImpl can cause > deadlocks. Because their model is similar to the following > {code:java} > Sync sync; > > void init() { > sync = getSync(); > } > > void onUpdate(val) { > if(sync == null) { > return; > } > update(sync); > } > {code} > If init and onUpdate occur at the same time, update may be missed and lagging > data may be obtained. The fix I gave is similar to: > {code:java} > Sync sync; > boolean flag = false; > > void init() { > do { > flag = false; > s = getSync(); > } while(flag); > } > > void onUpdate(val) { > if(sync == null) { > flag = true; > return; > } > update(sync); > } > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)