You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@opennlp.apache.org by "Fergal Monaghan (JIRA)" <ji...@apache.org> on 2015/08/17 13:26:45 UTC
[jira] [Created] (OPENNLP-808) AbstractBottomUpParser is not thread
safe
Fergal Monaghan created OPENNLP-808:
---------------------------------------
Summary: AbstractBottomUpParser is not thread safe
Key: OPENNLP-808
URL: https://issues.apache.org/jira/browse/OPENNLP-808
Project: OpenNLP
Issue Type: Bug
Components: Parser
Affects Versions: tools-1.5.3
Environment: Ubuntu 14.04.3 LTS
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
Reporter: Fergal Monaghan
I'm actually not sure if this is really a "Major" "Bug" as I have listed it, perhaps it is by design. However even in this case this issue should possibly be listed as an "Improvement".
Steps to recreate:
1. Run 2 or more threads simultaneously which make calls to the same parser object.
2. Line 281 of opennlp.tools.parser.AbstractBottomUpParser throws a java.util.ConcurrentModificationException from java.util.ArrayList iterator due to the `odh` field being global/shared in the object and not local to the method.
Unless there are serious memory reasons for doing so, I would strongly recommend that such fields should be local to the method since thread safety may take precedence over the memory saved in this case. As is, any code that calls the parser has to be enclosed in a giant synchronized block, and all applications using the parsers have serious performance issues/do not make use of modern hardware.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)