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

Robert Muir commented on LUCENE-5286:
-------------------------------------

FYI: QueryParser documents that its not thread-safe.
If you tried to use it in multiple threads, you would encounter a number of 
other issues (not just these)

{code}
 * <p>Note that QueryParser is <em>not</em> thread-safe.</p> 
{code}

> data races in org.apache.lucene.queryParser.QueryParserTokenManager
> -------------------------------------------------------------------
>
>                 Key: LUCENE-5286
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5286
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/queryparser
>    Affects Versions: 3.6.2
>            Reporter: Jeff Huang
>
> Hi, 
> We ran a dynamic detector on Lucene and found quite a number of races in 
> org.apache.lucene.queryParser.QueryParserTokenManager when an instance of 
> this class is shared by multiple threads. Almost all field variables of this 
> class are racey, e.g., curChar, curLexState jjnewStateCnt jjmatchedPos 
> jjmatchedKind. 
> For example, methods "jjMoveStringLiteralDfa0_3" and "getNextToken" can be 
> executed by different threads at the same time with no synchronization. The 
> read and write to "curChar" at lines 65 and 1174 may corrupt the parser.
> 63  private int More jjMoveStringLiteralDfa0_3()
> 64  {
> 65     switch(curChar)
> 66     {
> 1164public Token More getNextToken() 
> 1165{
> 1166  Token matchedToken;
> 1167  int curPos = 0;
> 1168
> 1169  EOFLoop :
> 1170  for (;;)
> 1171  {
> 1172   try
> 1173   {
> 1174      curChar = input_stream.BeginToken();
> 1175   }



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to