You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (JIRA)" <ji...@apache.org> on 2013/06/05 23:11:20 UTC

[jira] [Commented] (JENA-467) IRIResolverNormal should use synchronized CacheLRU

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

Andy Seaborne commented on JENA-467:
------------------------------------

That'll help but it imposes the sync cost on all resolvers and at all points of use.  It's only the use of the use of the shared global resolver in the IRIResolverNormal constructor that needs protecting.  See two attached patches (different ways to achieve the same thing).  A review of the code use of globalResolver is needed as well.
                
> IRIResolverNormal should use synchronized CacheLRU
> --------------------------------------------------
>
>                 Key: JENA-467
>                 URL: https://issues.apache.org/jira/browse/JENA-467
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: Jena 2.10.1
>         Environment: Any IBM JRE 6 or higher
>            Reporter: Simon Helsen
>            Priority: Critical
>         Attachments: iriresolver-patch-2.txt, iriresolver-patch.txt, patch.txt
>
>
> 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

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira