apache / apache/lucene

Possible order violation in lucene library version 2.4.1 [LUCENE-5732]

Open
#6,794 0 comments 0 reactions 0 assignees View on GitHub
affects-version:2.4.1 legacy-jira-priority:Major module:core/store type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Hi,

I am working on a research project on data race detection, and am using the DaCapo benchmarks for evaluation. I am using the benchmark lusearch from the 2009 suite, which uses lucene library 2.4.1.

For one test case, I am monitoring a pair of accesses
say, Lorg/apache/lucene/store/Directory;.<init> ()V:40(6) and
Lorg/apache/lucene/store/FSDirectory;.close ()V:524(1). The format is <class name>.<method name> <method desc>:line(byte code index).

During my work, I am getting AlreadyClosedExceptions on the FSDirectory from the ensureOpen() method for some threads, which I think is probably due to an order violation. I have actually introduced delays
in my instrumentation which delays threads that execute the code in
Lorg/apache/lucene/store/FSDirectory;.close ()V. This is causing the other query threads to throw an exception.

Here is the exception trace:

org.apache.lucene.store.AlreadyClosedException: this Directory is closed
at org.apache.lucene.store.Directory.ensureOpen(Directory.java:220)
at org.apache.lucene.store.FSDirectory.list(FSDirectory.java:320)
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:533)
at org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:115)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:206)
at org.dacapo.lusearch.Search$QueryProcessor.<init>(Search.java:207)
at org.dacapo.lusearch.Search$QueryThread.run(Search.java:179)
org.apache.lucene.store.AlreadyClosedException: this Directory is closed
at org.apache.lucene.store.Directory.ensureOpen(Directory.java:220)
at org.apache.lucene.store.FSDirectory.list(FSDirectory.java:320)
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:533)
at org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:115)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:206)
at org.dacapo.lusearch.Search$QueryProcessor.<init>(Search.java:207)
at org.dacapo.lusearch.Search$QueryThread.run(Search.java:179)
java.lang.NullPointerException
at org.dacapo.lusearch.Search$QueryProcessor.run(Search.java:226)
at org.dacapo.lusearch.Search$QueryThread.run(Search.java:179)
java.lang.NullPointerException
at org.dacapo.lusearch.Search$QueryProcessor.run(Search.java:226)
at org.dacapo.lusearch.Search$QueryThread.run(Search.java:179)
org.apache.lucene.store.AlreadyClosedException: this Directory is closed
at org.apache.lucene.store.Directory.ensureOpen(Directory.java:220)
at org.apache.lucene.store.FSDirectory.list(FSDirectory.java:320)
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:533)
at org.apache.lucene.index.DirectoryIndexReader.open(DirectoryIndexReader.java:115)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:316)
at org.apache.lucene.index.IndexReader.open(IndexReader.java:206)
at org.dacapo.lusearch.Search$QueryProcessor.<init>(Search.java:207)
at org.dacapo.lusearch.Search$QueryThread.run(Search.java:179)
java.lang.NullPointerException
at org.dacapo.lusearch.Search$QueryProcessor.run(Search.java:226)
at org.dacapo.lusearch.Search$QueryThread.run(Search.java:179)

This exception does not happen during normal instrumentation, but can easily be reproduced by introducing just delays in the instrumentation.

---
Migrated from [LUCENE-5732](https://issues.apache.org/jira/browse/LUCENE-5732) by Swarnendu Biswas
Environment:
```
RHEL 6.5, 64 bit, Intel i5
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the DaCapo 2009 lusearch benchmark and the reported instrumentation delays. Start at org.apache.lucene.store.Directory.ensureOpen, FSDirectory.close/list, and the stack-trace paths through IndexReader.open; compare them with org.dacapo.lusearch.Search.QueryProcessor. The report does not define a specific fix, so completion requires confirming the ordering defect and agreeing on the expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.