[jira] [Commented] (GEODE-4957) The key used in a putIfAbsent call that returns null may not be the one in the RegionEntry

2018-07-10 Thread Darrel Schneider (JIRA)


[ 
https://issues.apache.org/jira/browse/GEODE-4957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16539402#comment-16539402
 ] 

Darrel Schneider commented on GEODE-4957:
-

It was fixed with the final commit: c020dc9aeaf68f91d9da1182cec78930550b5d6b

At the time that was committed the next geode release was 1.7 as marked in this 
ticket.

> The key used in a putIfAbsent call that returns null may not be the one in 
> the RegionEntry
> --
>
> Key: GEODE-4957
> URL: https://issues.apache.org/jira/browse/GEODE-4957
> Project: Geode
>  Issue Type: Bug
>  Components: regions
>Reporter: Barry Oglesby
>Assignee: Darrel Schneider
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.7.0
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> With simultaneous putIfAbsent calls, sometimes the thread that returns null 
> is not the thread that actually creates the RegionEntry.
> Below is some logging that shows this behavior.
> Thread-77 returns null from the putIfAbsent call (which means there was no 
> previous value). 1 ms before Thread-77's putEntryIfAbsent call, Thread-9 
> creates the RegionEntry. You can see that because not only is oldRe=null for 
> Thread-9, but also the event's key (eventKey) and entry's key (reKey) are 
> identical. But Thread-9 returns a non-null old value.
> {noformat}
> Thread-77 at 1522187267493: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@6a8119a0 
> (key=ComplexKey[identity=1682369152; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); 
> oldRe=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null)
> Thread-77 at 1522187267493: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=1682369152; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-77 at 1522187267500: LocalRegion.putIfAbsent returning null
> {noformat}
> {noformat}
> Thread-9 at 1522187267492: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); oldRe=null
> Thread-9 at 1522187267495: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=342592289; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-9 at 1522187267504: LocalRegion.putIfAbsent returning v1
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GEODE-4957) The key used in a putIfAbsent call that returns null may not be the one in the RegionEntry

2018-06-13 Thread Alexander Murmann (JIRA)


[ 
https://issues.apache.org/jira/browse/GEODE-4957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16511859#comment-16511859
 ] 

Alexander Murmann commented on GEODE-4957:
--

[~dschneider] This shows up as closed, however when looking at the commit 
history I am seeing so many reverts that I am unsure what's going on here. Is 
this actually fixed? Do we know what the affected versions were?

> The key used in a putIfAbsent call that returns null may not be the one in 
> the RegionEntry
> --
>
> Key: GEODE-4957
> URL: https://issues.apache.org/jira/browse/GEODE-4957
> Project: Geode
>  Issue Type: Bug
>  Components: regions
>Reporter: Barry Oglesby
>Assignee: Darrel Schneider
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.7.0
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> With simultaneous putIfAbsent calls, sometimes the thread that returns null 
> is not the thread that actually creates the RegionEntry.
> Below is some logging that shows this behavior.
> Thread-77 returns null from the putIfAbsent call (which means there was no 
> previous value). 1 ms before Thread-77's putEntryIfAbsent call, Thread-9 
> creates the RegionEntry. You can see that because not only is oldRe=null for 
> Thread-9, but also the event's key (eventKey) and entry's key (reKey) are 
> identical. But Thread-9 returns a non-null old value.
> {noformat}
> Thread-77 at 1522187267493: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@6a8119a0 
> (key=ComplexKey[identity=1682369152; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); 
> oldRe=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null)
> Thread-77 at 1522187267493: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=1682369152; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-77 at 1522187267500: LocalRegion.putIfAbsent returning null
> {noformat}
> {noformat}
> Thread-9 at 1522187267492: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); oldRe=null
> Thread-9 at 1522187267495: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=342592289; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-9 at 1522187267504: LocalRegion.putIfAbsent returning v1
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GEODE-4957) The key used in a putIfAbsent call that returns null may not be the one in the RegionEntry

2018-04-24 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-4957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16451291#comment-16451291
 ] 

ASF subversion and git services commented on GEODE-4957:


Commit c020dc9aeaf68f91d9da1182cec78930550b5d6b in geode's branch 
refs/heads/feature/GEODE-925 from [~dschneider]
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=c020dc9 ]

GEODE-4957: fix race in concurrent create on region (#1836)

Reverted the revert of GEODE-4957.
Only cleanup if basicPut created a new region entry and its value at the end is 
still REMOVED_PHASE1


> The key used in a putIfAbsent call that returns null may not be the one in 
> the RegionEntry
> --
>
> Key: GEODE-4957
> URL: https://issues.apache.org/jira/browse/GEODE-4957
> Project: Geode
>  Issue Type: Bug
>  Components: regions
>Reporter: Barry Oglesby
>Assignee: Darrel Schneider
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.7.0
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> With simultaneous putIfAbsent calls, sometimes the thread that returns null 
> is not the thread that actually creates the RegionEntry.
> Below is some logging that shows this behavior.
> Thread-77 returns null from the putIfAbsent call (which means there was no 
> previous value). 1 ms before Thread-77's putEntryIfAbsent call, Thread-9 
> creates the RegionEntry. You can see that because not only is oldRe=null for 
> Thread-9, but also the event's key (eventKey) and entry's key (reKey) are 
> identical. But Thread-9 returns a non-null old value.
> {noformat}
> Thread-77 at 1522187267493: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@6a8119a0 
> (key=ComplexKey[identity=1682369152; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); 
> oldRe=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null)
> Thread-77 at 1522187267493: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=1682369152; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-77 at 1522187267500: LocalRegion.putIfAbsent returning null
> {noformat}
> {noformat}
> Thread-9 at 1522187267492: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); oldRe=null
> Thread-9 at 1522187267495: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=342592289; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-9 at 1522187267504: LocalRegion.putIfAbsent returning v1
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GEODE-4957) The key used in a putIfAbsent call that returns null may not be the one in the RegionEntry

2018-04-24 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-4957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16451293#comment-16451293
 ] 

ASF subversion and git services commented on GEODE-4957:


Commit c020dc9aeaf68f91d9da1182cec78930550b5d6b in geode's branch 
refs/heads/feature/GEODE-925 from [~dschneider]
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=c020dc9 ]

GEODE-4957: fix race in concurrent create on region (#1836)

Reverted the revert of GEODE-4957.
Only cleanup if basicPut created a new region entry and its value at the end is 
still REMOVED_PHASE1


> The key used in a putIfAbsent call that returns null may not be the one in 
> the RegionEntry
> --
>
> Key: GEODE-4957
> URL: https://issues.apache.org/jira/browse/GEODE-4957
> Project: Geode
>  Issue Type: Bug
>  Components: regions
>Reporter: Barry Oglesby
>Assignee: Darrel Schneider
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.7.0
>
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> With simultaneous putIfAbsent calls, sometimes the thread that returns null 
> is not the thread that actually creates the RegionEntry.
> Below is some logging that shows this behavior.
> Thread-77 returns null from the putIfAbsent call (which means there was no 
> previous value). 1 ms before Thread-77's putEntryIfAbsent call, Thread-9 
> creates the RegionEntry. You can see that because not only is oldRe=null for 
> Thread-9, but also the event's key (eventKey) and entry's key (reKey) are 
> identical. But Thread-9 returns a non-null old value.
> {noformat}
> Thread-77 at 1522187267493: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@6a8119a0 
> (key=ComplexKey[identity=1682369152; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); 
> oldRe=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null)
> Thread-77 at 1522187267493: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=1682369152; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-77 at 1522187267500: LocalRegion.putIfAbsent returning null
> {noformat}
> {noformat}
> Thread-9 at 1522187267492: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); oldRe=null
> Thread-9 at 1522187267495: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=342592289; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-9 at 1522187267504: LocalRegion.putIfAbsent returning v1
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GEODE-4957) The key used in a putIfAbsent call that returns null may not be the one in the RegionEntry

2018-04-24 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-4957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16450399#comment-16450399
 ] 

ASF subversion and git services commented on GEODE-4957:


Commit c020dc9aeaf68f91d9da1182cec78930550b5d6b in geode's branch 
refs/heads/develop from [~dschneider]
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=c020dc9 ]

GEODE-4957: fix race in concurrent create on region (#1836)

Reverted the revert of GEODE-4957.
Only cleanup if basicPut created a new region entry and its value at the end is 
still REMOVED_PHASE1


> The key used in a putIfAbsent call that returns null may not be the one in 
> the RegionEntry
> --
>
> Key: GEODE-4957
> URL: https://issues.apache.org/jira/browse/GEODE-4957
> Project: Geode
>  Issue Type: Bug
>  Components: regions
>Reporter: Barry Oglesby
>Assignee: Darrel Schneider
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> With simultaneous putIfAbsent calls, sometimes the thread that returns null 
> is not the thread that actually creates the RegionEntry.
> Below is some logging that shows this behavior.
> Thread-77 returns null from the putIfAbsent call (which means there was no 
> previous value). 1 ms before Thread-77's putEntryIfAbsent call, Thread-9 
> creates the RegionEntry. You can see that because not only is oldRe=null for 
> Thread-9, but also the event's key (eventKey) and entry's key (reKey) are 
> identical. But Thread-9 returns a non-null old value.
> {noformat}
> Thread-77 at 1522187267493: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@6a8119a0 
> (key=ComplexKey[identity=1682369152; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); 
> oldRe=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null)
> Thread-77 at 1522187267493: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=1682369152; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-77 at 1522187267500: LocalRegion.putIfAbsent returning null
> {noformat}
> {noformat}
> Thread-9 at 1522187267492: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); oldRe=null
> Thread-9 at 1522187267495: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=342592289; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-9 at 1522187267504: LocalRegion.putIfAbsent returning v1
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GEODE-4957) The key used in a putIfAbsent call that returns null may not be the one in the RegionEntry

2018-04-24 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-4957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16450398#comment-16450398
 ] 

ASF subversion and git services commented on GEODE-4957:


Commit c020dc9aeaf68f91d9da1182cec78930550b5d6b in geode's branch 
refs/heads/develop from [~dschneider]
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=c020dc9 ]

GEODE-4957: fix race in concurrent create on region (#1836)

Reverted the revert of GEODE-4957.
Only cleanup if basicPut created a new region entry and its value at the end is 
still REMOVED_PHASE1


> The key used in a putIfAbsent call that returns null may not be the one in 
> the RegionEntry
> --
>
> Key: GEODE-4957
> URL: https://issues.apache.org/jira/browse/GEODE-4957
> Project: Geode
>  Issue Type: Bug
>  Components: regions
>Reporter: Barry Oglesby
>Assignee: Darrel Schneider
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> With simultaneous putIfAbsent calls, sometimes the thread that returns null 
> is not the thread that actually creates the RegionEntry.
> Below is some logging that shows this behavior.
> Thread-77 returns null from the putIfAbsent call (which means there was no 
> previous value). 1 ms before Thread-77's putEntryIfAbsent call, Thread-9 
> creates the RegionEntry. You can see that because not only is oldRe=null for 
> Thread-9, but also the event's key (eventKey) and entry's key (reKey) are 
> identical. But Thread-9 returns a non-null old value.
> {noformat}
> Thread-77 at 1522187267493: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@6a8119a0 
> (key=ComplexKey[identity=1682369152; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); 
> oldRe=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null)
> Thread-77 at 1522187267493: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=1682369152; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-77 at 1522187267500: LocalRegion.putIfAbsent returning null
> {noformat}
> {noformat}
> Thread-9 at 1522187267492: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); oldRe=null
> Thread-9 at 1522187267495: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=342592289; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-9 at 1522187267504: LocalRegion.putIfAbsent returning v1
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GEODE-4957) The key used in a putIfAbsent call that returns null may not be the one in the RegionEntry

2018-04-17 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-4957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16441372#comment-16441372
 ] 

ASF subversion and git services commented on GEODE-4957:


Commit 33f8f5fadbe5655a31f2607dd121fc97e1a373f3 in geode's branch 
refs/heads/develop from [~dschneider]
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=33f8f5f ]

Revert "GEODE-4957: fix race in concurrent create on region (#1750)" (#1812)

This reverts commit 65b52f28f4e11b9f5ec82b0e457fc0292132e5da.

> The key used in a putIfAbsent call that returns null may not be the one in 
> the RegionEntry
> --
>
> Key: GEODE-4957
> URL: https://issues.apache.org/jira/browse/GEODE-4957
> Project: Geode
>  Issue Type: Bug
>  Components: regions
>Reporter: Barry Oglesby
>Assignee: Darrel Schneider
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> With simultaneous putIfAbsent calls, sometimes the thread that returns null 
> is not the thread that actually creates the RegionEntry.
> Below is some logging that shows this behavior.
> Thread-77 returns null from the putIfAbsent call (which means there was no 
> previous value). 1 ms before Thread-77's putEntryIfAbsent call, Thread-9 
> creates the RegionEntry. You can see that because not only is oldRe=null for 
> Thread-9, but also the event's key (eventKey) and entry's key (reKey) are 
> identical. But Thread-9 returns a non-null old value.
> {noformat}
> Thread-77 at 1522187267493: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@6a8119a0 
> (key=ComplexKey[identity=1682369152; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); 
> oldRe=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null)
> Thread-77 at 1522187267493: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=1682369152; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-77 at 1522187267500: LocalRegion.putIfAbsent returning null
> {noformat}
> {noformat}
> Thread-9 at 1522187267492: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); oldRe=null
> Thread-9 at 1522187267495: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=342592289; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-9 at 1522187267504: LocalRegion.putIfAbsent returning v1
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GEODE-4957) The key used in a putIfAbsent call that returns null may not be the one in the RegionEntry

2018-04-12 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-4957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16436113#comment-16436113
 ] 

ASF subversion and git services commented on GEODE-4957:


Commit 65b52f28f4e11b9f5ec82b0e457fc0292132e5da in geode's branch 
refs/heads/develop from [~dschneider]
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=65b52f2 ]

GEODE-4957: fix race in concurrent create on region (#1750)

Refactored basicPut so that a RegionEntry with REMOVE_PHASE1
is added to the map, it will already be synchronized.
This prevents a second concurrent threads from "stealing" it and
creating a region entry with a key that is the same but has a different
identity.


> The key used in a putIfAbsent call that returns null may not be the one in 
> the RegionEntry
> --
>
> Key: GEODE-4957
> URL: https://issues.apache.org/jira/browse/GEODE-4957
> Project: Geode
>  Issue Type: Bug
>  Components: regions
>Reporter: Barry Oglesby
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> With simultaneous putIfAbsent calls, sometimes the thread that returns null 
> is not the thread that actually creates the RegionEntry.
> Below is some logging that shows this behavior.
> Thread-77 returns null from the putIfAbsent call (which means there was no 
> previous value). 1 ms before Thread-77's putEntryIfAbsent call, Thread-9 
> creates the RegionEntry. You can see that because not only is oldRe=null for 
> Thread-9, but also the event's key (eventKey) and entry's key (reKey) are 
> identical. But Thread-9 returns a non-null old value.
> {noformat}
> Thread-77 at 1522187267493: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@6a8119a0 
> (key=ComplexKey[identity=1682369152; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); 
> oldRe=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null)
> Thread-77 at 1522187267493: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=1682369152; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-77 at 1522187267500: LocalRegion.putIfAbsent returning null
> {noformat}
> {noformat}
> Thread-9 at 1522187267492: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); oldRe=null
> Thread-9 at 1522187267495: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=342592289; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-9 at 1522187267504: LocalRegion.putIfAbsent returning v1
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (GEODE-4957) The key used in a putIfAbsent call that returns null may not be the one in the RegionEntry

2018-04-03 Thread Darrel Schneider (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-4957?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16424728#comment-16424728
 ] 

Darrel Schneider commented on GEODE-4957:
-

I think this is what is happening:

Thread 1 does putIfAbsent(k1, v1) and adds a new RegionEntry to the map with k1 
and value REMOVE_PHASE1

Thread 2 does putIfAbsent(k2, v2) and finds the RegionEntry that Thread 1 added 
because k1.equals(k2). It syncs this RegionEntry and sets the value to v2. It 
returns null because the old value was REMOVE_PHASE1.

Thread 1 then syncs the RegionEntry and finds the value is v2 so putIfAbsent 
does not put but returns v2.

So when this happens the key will be k1 even though Thread 2 is the one that 
did the putIfAbsent.

I think we can fix this by having AbstractRegionMap.basicPut when it is doing a 
create (ifNew==true) check to see if the key has the same identity (==) as the 
one on the region entry. If it is not identical then it can change the key on 
the RegionEntry. Since the key has the same hash I think this is safe.

 Another solution is to treat REMOVE_PHASE1 with a non-identical key like we do 
REMOVE_PHASE2. In that case we remove the old RegionEntry and then create a new 
one and do a retry. The problem with this is two or more threads could keep 
doing this to each other, spinning around possibly forever.

The best solution would be to refactor getOrCreateRegionEntry so that when it 
adds a new RegionEntry that is REMOVE_PHASE1 it is already synced. The code 
used to be this way but was changed when the getOrCreateRegionEntry method was 
introduced. If we could do it like this then this bug goes away because no 
other thread can change the RegionEntry we add with REMOVE_PHASE1 so it will 
already have our key in it.

 

> The key used in a putIfAbsent call that returns null may not be the one in 
> the RegionEntry
> --
>
> Key: GEODE-4957
> URL: https://issues.apache.org/jira/browse/GEODE-4957
> Project: Geode
>  Issue Type: Bug
>  Components: regions
>Reporter: Barry Oglesby
>Priority: Major
>
> With simultaneous putIfAbsent calls, sometimes the thread that returns null 
> is not the thread that actually creates the RegionEntry.
> Below is some logging that shows this behavior.
> Thread-77 returns null from the putIfAbsent call (which means there was no 
> previous value). 1 ms before Thread-77's putEntryIfAbsent call, Thread-9 
> creates the RegionEntry. You can see that because not only is oldRe=null for 
> Thread-9, but also the event's key (eventKey) and entry's key (reKey) are 
> identical. But Thread-9 returns a non-null old value.
> {noformat}
> Thread-77 at 1522187267493: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@6a8119a0 
> (key=ComplexKey[identity=1682369152; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); 
> oldRe=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null)
> Thread-77 at 1522187267493: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=1682369152; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-77 at 1522187267500: LocalRegion.putIfAbsent returning null
> {noformat}
> {noformat}
> Thread-9 at 1522187267492: AbstractRegionMap.putEntryIfAbsent 
> regionEntry=VersionedStatsDiskLRURegionEntryHeapObjectKey@1aac7604 
> (key=ComplexKey[identity=342592289; key=key]; rawValue=REMOVED_PHASE1; 
> version=\{v0; rv0; ds=0; time=0};member=null); oldRe=null
> Thread-9 at 1522187267495: AbstractRegionMap.basicPut 
> eventKey=ComplexKey[identity=342592289; key=key]; 
> reKey=ComplexKey[identity=342592289; key=key]
> Thread-9 at 1522187267504: LocalRegion.putIfAbsent returning v1
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)