[GeoNetwork-devel] [GeoNetwork opensource Developer website] #576: LuceneIndexWriterFactory not thread safe

#576: LuceneIndexWriterFactory not thread safe
-------------------------+--------------------------------------------------
Reporter: jesseeichar | Owner: geonetwork-devel@…
     Type: defect | Status: new
Priority: major | Milestone: v2.6.5
Component: General | Version: v2.6.3
Keywords: |
-------------------------+--------------------------------------------------
There are two instances where the class is not thread safe.

If a field is accessed outside of a synchronized block that field may be
cached in the thread specific cache and therefore if one thread updates
the field the other threads may not get that update until some unknown
point in the future. The solutions are to only access fields shared
between threads in synchronized blocks or to set the field as volatile.

In Geonetwork code _writer was modified in a synchronized block but
accessed outside of it. In my patch I made _writer be volatile so that
each thread will always obtain the most recent version.

Second _optimized was also non-volatile and accessed inside and outside of
a synchronized block again resulting in cases where optimization could be
triggered multiple times by different threads. In my patch I change it to
use a java.util.concurrent.Lock so that it reduces geonetwork code.

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/576&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.

#576: LuceneIndexWriterFactory not thread safe
--------------------------+-------------------------------------------------
  Reporter: jesseeichar | Owner: geonetwork-devel@…
      Type: defect | Status: closed
  Priority: major | Milestone: v2.6.5
Component: General | Version: v2.6.3
Resolution: fixed | Keywords:
--------------------------+-------------------------------------------------
Changes (by simonp):

  * status: new => closed
  * resolution: => fixed

Comment:

Fixed in svn commit #8113 - thanks Jesse

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/576#comment:1&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/geonetwork/&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.