[jbosscache-issues] [JBoss JIRA] Updated: (JBCACHE-1556) A race to "children loaded" flag in CacheLoadedInterceptor.loadChildren()
Krzysztof Sobolewski (JIRA)
jira-events at lists.jboss.org
Fri Nov 13 09:43:25 EST 2009
[ https://jira.jboss.org/jira/browse/JBCACHE-1556?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Krzysztof Sobolewski updated JBCACHE-1556:
------------------------------------------
Attachment: ChildrenLoadingRaceTest.java
The test.
> A race to "children loaded" flag in CacheLoadedInterceptor.loadChildren()
> -------------------------------------------------------------------------
>
> Key: JBCACHE-1556
> URL: https://jira.jboss.org/jira/browse/JBCACHE-1556
> Project: JBoss Cache
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Cache loaders, Transactions
> Affects Versions: 3.2.1.GA
> Reporter: Krzysztof Sobolewski
> Assignee: Manik Surtani
> Attachments: ChildrenLoadingRaceTest-fix.diff, ChildrenLoadingRaceTest.java
>
>
> We found a race in CacheLoaderInterceptor.loadChildren() that goes like this:
> 1) There is a node /a with evicted children /a/a and /a/b; the node itself is *not* evicted
> 2) Transaction T1 wants to get the children list of /a
> 3) Transaction T2 wants to get the children list of /a
> 4) T1 gets to loadChildren() for /a, notices that the children are not loaded and proceeds to load them
> 4a) T1 loads the children and sets "children loaded" flag to true, but holds the names themselves in its context [this depends on isolation level, I guess]
> 5) T2 gets to the same point and sees that "children loaded" flag is set, so it skips loading
> 6a) T1 correctly returns "a" and "b"
> 6b) T2 returns whatever was in memory at that point [in the attached test it's "a", but I would expect empty set]
> I fixed it by acquiring a lock on the parent node, forcing both transactions to serialize the access (but not preventing from loading the children twice).
> The patch depends on the one proposed for JBCACHE-1553 (it's in the same place and they interact in non-trivial way)
> Also note that the "lock parent for child insert remove" config option does not affect the result of the test.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jbosscache-issues
mailing list