[ 
https://issues.apache.org/jira/browse/JENA-597?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Scott Patterson updated JENA-597:
---------------------------------

    Description: 
The following exception may occur when more than one thread requires access to 
the org.apache.jena.atlas.lib.cache.CacheLRU embedded in IRIResolverNormal:

Caused by: java.lang.NullPointerException
        at java.util.LinkedHashMap.get(LinkedHashMap.java:339)
        at org.apache.jena.atlas.lib.cache.CacheLRU.get(CacheLRU.java:53)
        at 
org.apache.jena.riot.system.IRIResolver$IRIResolverNormal.resolveSilent(IRIResolver.java:427)
        at 
org.apache.jena.riot.system.IRIResolver$IRIResolverNormal.<init>(IRIResolver.java:383)
        at org.apache.jena.riot.system.IRIResolver.create(IRIResolver.java:210)
        at org.apache.jena.riot.system.RiotLib.profile(RiotLib.java:141)
        at org.apache.jena.riot.system.RiotLib.profile(RiotLib.java:130)
        at org.apache.jena.riot.lang.LangRDFXML.<init>(LangRDFXML.java:104)
        at org.apache.jena.riot.lang.LangRDFXML.create(LangRDFXML.java:74)
        at org.apache.jena.riot.RiotReader.createParser(RiotReader.java:128)
        at 
org.apache.jena.riot.RDFParserRegistry$ReaderRIOTFactoryImpl$1.read(RDFParserRegistry.java:141)
        at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:818)
        at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:258)
        at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:244)
        at 
org.apache.jena.riot.adapters.RDFReaderRIOT.read(RDFReaderRIOT.java:69)
        at com.ibm.team.jis.lqe.resource.RDFEntity.getModel(RDFEntity.java:361)
        ... 39 more

This may be related to the problem reported that is suppose to be fixed by the 
cloned issue. It looks to be the same stack trace. I've attached a test to 
reproduce. Works with Oracle 7 JRE but not IBM 7.

  was:
The following exception may occur on an IBM JRE 6 or higher when more than one 
thread requires access to the org.apache.jena.atlas.lib.cache.CacheLRU embedded 
in IRIResolverNormal:

Caused by: java.lang.NullPointerException
        at java.util.LinkedHashMap.get(LinkedHashMap.java:337)
        at org.apache.jena.atlas.lib.cache.CacheLRU.get(CacheLRU.java:53)
        at 
org.apache.jena.riot.system.IRIResolver$IRIResolverNormal.resolveSilent(IRIResolver.java:403)
        at 
org.apache.jena.riot.system.IRIResolver$IRIResolverNormal.<init>(IRIResolver.java:359)
        at org.apache.jena.riot.system.IRIResolver.create(IRIResolver.java:212)
        at org.apache.jena.riot.system.RiotLib.profile(RiotLib.java:141)
        at org.apache.jena.riot.system.RiotLib.profile(RiotLib.java:130)
        at org.apache.jena.riot.system.RiotLib.profile(RiotLib.java:117)
        at 
org.apache.jena.riot.RiotReader.createParserTurtle(RiotReader.java:310)
        at org.apache.jena.riot.RiotReader.createParser(RiotReader.java:142)
        at org.apache.jena.riot.RiotReader.createParser(RiotReader.java:133)
        at 
org.apache.jena.riot.RDFParserRegistry$ReaderRIOTFactoryImpl$1.read(RDFParserRegistry.java:141)
        at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:760)
        at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:258)
        at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:244)
        ... 20 more

The problem seems to only occurs on IBM JRE 6 or higher as its implementation 
of LinkedHashMap is not thread safe. Note that the JDK specification does not 
required LinkedHashMap to be thread safe. 

The solution is to make use of CacheFactory.createSync when creating the Cache 
in the IRIResolverNormal. Patch attached


> IRIResolverNormal needs thread safe CacheLRU
> --------------------------------------------
>
>                 Key: JENA-597
>                 URL: https://issues.apache.org/jira/browse/JENA-597
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: Jena 2.11.0
>         Environment: Any IBM JRE 7 or higher
>            Reporter: Scott Patterson
>            Assignee: Andy Seaborne
>         Attachments: IRIResolverTest.java
>
>
> The following exception may occur when more than one thread requires access 
> to the org.apache.jena.atlas.lib.cache.CacheLRU embedded in IRIResolverNormal:
> Caused by: java.lang.NullPointerException
>       at java.util.LinkedHashMap.get(LinkedHashMap.java:339)
>       at org.apache.jena.atlas.lib.cache.CacheLRU.get(CacheLRU.java:53)
>       at 
> org.apache.jena.riot.system.IRIResolver$IRIResolverNormal.resolveSilent(IRIResolver.java:427)
>       at 
> org.apache.jena.riot.system.IRIResolver$IRIResolverNormal.<init>(IRIResolver.java:383)
>       at org.apache.jena.riot.system.IRIResolver.create(IRIResolver.java:210)
>       at org.apache.jena.riot.system.RiotLib.profile(RiotLib.java:141)
>       at org.apache.jena.riot.system.RiotLib.profile(RiotLib.java:130)
>       at org.apache.jena.riot.lang.LangRDFXML.<init>(LangRDFXML.java:104)
>       at org.apache.jena.riot.lang.LangRDFXML.create(LangRDFXML.java:74)
>       at org.apache.jena.riot.RiotReader.createParser(RiotReader.java:128)
>       at 
> org.apache.jena.riot.RDFParserRegistry$ReaderRIOTFactoryImpl$1.read(RDFParserRegistry.java:141)
>       at org.apache.jena.riot.RDFDataMgr.process(RDFDataMgr.java:818)
>       at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:258)
>       at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:244)
>       at 
> org.apache.jena.riot.adapters.RDFReaderRIOT.read(RDFReaderRIOT.java:69)
>       at com.ibm.team.jis.lqe.resource.RDFEntity.getModel(RDFEntity.java:361)
>       ... 39 more
> This may be related to the problem reported that is suppose to be fixed by 
> the cloned issue. It looks to be the same stack trace. I've attached a test 
> to reproduce. Works with Oracle 7 JRE but not IBM 7.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to