Opened 14 years ago

Closed 13 years ago

#247 closed defect (fixed)

org.apache.lucene.store.AlreadyClosedException occurs for concurrent CSW getRecords requests

Reported by: simonp Owned by: simonp
Priority: major Milestone: v2.5.1
Component: General Version: v2.5.0
Keywords: CSW Cc:

Description

Reported by Kai:

I tried with JMeter using this request with the geonetwork

<?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">

<env:Body>

<csw:GetRecords

xmlns:csw="http://www.opengis.net/cat/csw/2.0.2"> xmlns:ogc="http://www.opengis.net/ogc" maxRecords="10"

outputFormat="application/xml" outputSchema="

http://www.opengis.net/cat/csw/2.0.2"

resultType="results" service="CSW" version="2.0.2">

<csw:Query typeNames="csw:Record">

<csw:ElementSetName>full</csw:ElementSetName> <csw:Constraint version="1.1.0">

<ogc:Filter

xmlns:gml="http://www.opengis.net/gml">

<ogc:PropertyIsLike escape="\" singleChar="_" wildCard="%">

<ogc:PropertyName>AnyText</ogc:PropertyName> <ogc:Literal>%water%</ogc:Literal>

</ogc:PropertyIsLike>

</ogc:Filter>

</csw:Constraint>

</csw:Query>

</csw:GetRecords>

</env:Body>

</env:Envelope>

64 threads/0s ramp period/ no error 128 threads/0s ramp period/ there will be an error in geonetwork.log :

2010-07-01 15:55:47,074 ERROR [jeeves.service] - (C) Exc : org.apache.lucene.store.AlreadyClosedException: this IndexReader is closed 2010-07-01 15:55:47,075 DEBUG [jeeves.service] - Raised exception while executing service <error id="error">

<message>this IndexReader is closed</message> <class>AlreadyClosedException</class> <stack>

<at class="org.apache.lucene.index.IndexReader" file="IndexReader.java" line="209" method="ensureOpen" /> <at class="org.apache.lucene.index.DirectoryOwningReader" file="DirectoryOwningReader.java" line="44" method="reopen" /> <at class="org.fao.geonet.kernel.search.LuceneIndexReaderFactory" file="LuceneIndexReaderFactory.java" line="74" method="maybeReopen" /> <at class="org.fao.geonet.kernel.search.LuceneIndexReaderFactory" file="LuceneIndexReaderFactory.java" line="41" method="getReader" /> <at class="org.fao.geonet.kernel.search.SearchManager" file="SearchManager.java" line="744" method="getIndexReader" /> <at class="org.fao.geonet.kernel.search.LuceneSearcher" file="LuceneSearcher.java" line="134" method="search" /> <at class="org.fao.geonet.services.main.Search" file="Search.java" line="146" method="exec" /> <at class="jeeves.server.dispatchers.ServiceInfo" file="???" line="-1" method="execService" /> <at class="jeeves.server.dispatchers.ServiceInfo" file="???" line="-1" method="execServices" /> <at class="jeeves.server.dispatchers.ServiceManager" file="???" line="-1" method="dispatch" />

</stack> <request>

<language>en</language> <service>main.search.embedded</service>

</request>

</error>

Attachments (1)

247_fix_csw_locking.patch (1.3 KB ) - added by jesseeichar 13 years ago.
makes access to _reader threadsafe

Download all attachments as: .zip

Change History (4)

comment:1 by simonp, 14 years ago

Resolution: fixed
Status: newclosed

Fixed in commit #6262, tested with 512 concurrent GetRecords requests, 60 database connections in pool

comment:2 by jesseeichar, 13 years ago

Resolution: fixed
Status: closedreopened

I have found this error occurring on trunk again and have created a patch with a potential solution.

Essentially what is happening is in csw the part where the reader is reopened is not thread safe. My patch protects against this potential for corruption

by jesseeichar, 13 years ago

Attachment: 247_fix_csw_locking.patch added

makes access to _reader threadsafe

comment:3 by simonp, 13 years ago

Resolution: fixed
Status: reopenedclosed

Fixed in svn commit 8104 - Thanks Jesse

Note: See TracTickets for help on using tickets.