Re: [jira] Created: (JCS-73) concurrent cache access causes values loss
Aaron Smuts <[email protected]> Thu, 22 Apr 2010 06:41:25 -0700 (PDT)
| Newsgroups | gmane.comp.jakarta.turbine.jcs.devel |
|---|---|
| Message-ID | <750267.64381.qm__13623.335483908$1271943726$gmane$org@web38703.mail.mud.yahoo.com> |
The group functionality will be deprecated. It's already unofficially depr= ecated. Most of the auxiliaries don't support it. . . . But I look into i= t.=0A=0AAaron=0A=0A--- On Wed, 4/14/10, Alexander Kleymenov (JIRA) <jira@ap= ache.org> wrote:=0A=0A> From: Alexander Kleymenov (JIRA) <[email protected]>= =0A> Subject: [jira] Created: (JCS-73) concurrent cache access causes value= s loss=0A> To: [email protected]=0A> Date: Wednesday, April 14, 20= 10, 9:27 PM=0A> concurrent cache access causes values=0A> loss=0A> --------= ----------------------------------=0A> =0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A>= =A0=A0=A0Key: JCS-73=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0=A0=A0URL: htt= ps://issues.apache.org/jira/browse/JCS-73=0A> =A0 =A0 =A0 =A0 =A0=0A> =A0= =A0=A0Project: JCS=0A> =A0 =A0 =A0 =A0 =A0 Issue Type: Bug=0A> =A0 =A0 =A0 = =A0 =A0 Components: Indexed Disk=0A> Cache=0A> =A0 =A0 Affects Versions: jc= s-1.3=0A> =A0 =A0 =A0 =A0 =A0 =A0 Reporter:=0A> Alexander Kleymenov=0A> =A0= =A0 =A0 =A0 =A0 =A0 Assignee: Aaron=0A> Smuts=0A> =0A> =0A> The following = groovy code demonstrates the problem: several=0A> threads write to the cach= e and try to read previously=0A> written values. Sometimes values can be re= trieved. In this=0A> case, subsequent tries can get the value, but not alwa= ys.=0A> {code}=0A> cache =3D org.apache.jcs.JCS.getInstance("cache")=0A> gr= oup =3D "group"=0A> worker =3D {=0A> =A0 =A0 def name =3D Thread.currentThr= ead().name=0A> =A0 =A0 10000.times { idx ->=0A> =A0 =A0 =A0 =A0 if (idx) {= =0A> =A0 =A0 =A0 =A0 =A0 =A0 // get previously=0A> stored value=0A> =A0 =A0= =A0 =A0 =A0 =A0 def res =3D=0A> cache.getFromGroup(idx-1, group)=0A> =A0 = =A0 =A0 =A0 =A0 =A0 if (!res) {=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 //=0A> = null value got inspite of the fact it was placed in cache!=0A> =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0=0A> println "ERROR: for ${idx} in " + name=0A> =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 //=0A> try to get the value again:=0A> =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 def=0A> n =3D 5=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A>= while (n-- > 0) {=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 res =3D = cache.getFromGroup(idx-1, group)=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> = =A0 =A0 if (res) {=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 =A0 =A0 = // the value finally appeared in=0A> cache=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0=0A> =A0 =A0 =A0 =A0 println "ERROR FIXED for ${idx}:=0A> ${res} " + nam= e=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 =A0 =A0 break=0A> =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 }=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =0A> =A0 =A0 println "ERROR STILL PERSISTS for ${idx} in "=0A> + name=0A> = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 Thread.sleep(1000)=0A> =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 }=0A> =A0 =A0 =A0 =A0 =A0 =A0 }=0A> =A0 =A0 =A0 =A0= }=0A> =A0 =A0 =A0 =A0 // put value in the cache=0A> =A0 =A0 =A0 =A0 cache.= putInGroup(idx, group,=0A> [value:[a:1, b:2, c:3], aux:[1:'a', 2:'b', 3:'c'= , t:name]])=0A> =A0 =A0 =A0 =A0 if (!(idx % 10000)) {=0A> =A0 =A0 =A0 =A0 = =A0 =A0 println name+"=0A> "+idx=0A> =A0 =A0 =A0 =A0 }=0A> =A0 =A0 }=0A> }= =0A> =0A> Thread.start worker=0A> Thread.start worker=0A> Thread.start work= er=0A> Thread.start worker=0A> Thread.start worker=0A> Thread.start worker= =0A> Thread.start worker=0A> Thread.start worker=0A> {code}=0A> =0A> Cache = configuration:=0A> {code}=0A> jcs.default=3DCACHE=0A> jcs.default.cacheattr= ibutes=3Dorg.apache.jcs.engine.CompositeCacheAttributes=0A> jcs.default.cac= heattributes.MaxObjects=3D-1=0A> jcs.default.cacheattributes.MemoryCacheNam= e=3Dorg.apache.jcs.engine.memory.lru.LRUMemoryCache=0A> jcs.default.cacheat= tributes.DiskUsagePatternName=3DUPDATE=0A> jcs.default.cacheattributes.UseM= emoryShrinker=3Dtrue=0A> jcs.default.cacheattributes.MaxMemoryIdleTimeSecon= ds=3D10=0A> jcs.default.cacheattributes.ShrinkerIntervalSeconds=3D10=0A> jc= s.default.elementattributes=3Dorg.apache.jcs.engine.ElementAttributes=0A> j= cs.default.elementattributes.IsRemote=3Dfalse=0A> jcs.default.elementattrib= utes.IsLateral=3Dfalse=0A> jcs.default.elementattributes.IsSpool=3Dtrue=0A>= jcs.default.elementattributes.IsEternal=3Dtrue=0A> =0A> jcs.auxiliary.CACH= E=3Dorg.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory=0A> jcs.a= uxiliary.CACHE.attributes=3Dorg.apache.jcs.auxiliary.disk.indexed.IndexedDi= skCacheAttributes=0A> jcs.auxiliary.CACHE.attributes.DiskPath=3D./cache=0A>= jcs.auxiliary.CACHE.attributes.MaxPurgatorySize=3D-1=0A> jcs.auxiliary.CAC= HE.attributes.MaxKeySize=3D-1=0A> jcs.auxiliary.CACHE.attributes.MaxRecycle= BinSize=3D500=0A> jcs.auxiliary.CACHE.attributes.ShutdownSpoolTimeLimit=3D6= 0=0A> jcs.auxiliary.CACHE.attributes.OptimizeAtRemoveCount=3D30000=0A> jcs.= auxiliary.CACHE.attributes.OptimizeOnShutdown=3Dtrue=0A> jcs.auxiliary.CACH= E.attributes.EventQueueType=3DSINGLE=0A> {code}=0A> =0A> -- =0A> This messa= ge is automatically generated by JIRA.=0A> -=0A> If you think it was sent i= ncorrectly contact one of the=0A> administrators: https://issues.apache.org= /jira/secure/Administrators.jspa=0A> -=0A> For more information on JIRA, se= e: http://www.atlassian.com/software/jira=0A> =0A> =A0 =A0 =A0 =A0 =0A> =0A= > ---------------------------------------------------------------------=0A>= To unsubscribe, e-mail: [email protected]=0A> For add= itional commands, e-mail: [email protected]=0A> =0A>