|Title|JSPWiki initializing itself twice on startup - two Lucene Indexer threads started
|Date|01-Nov-2006 08:15:51 EET
|Version|2.4.71
|Submitter|206.152.117.245
|[Bug criticality]|BadBug
|Browser version|
|[Bug status]|ClosedBug
|[PageProvider] used|
|Servlet Container|Tomcat 4.1.30
|Operating System|Mac OSX
|URL|
|Java version|1.4.2

Two instances of the JSPWiki Lucene Indexer thread are being started.
It looks like JSPWiki is initializing itself twice from the jspwiki.log.

This causes a problem with application server shutdown. Only one Lucene
Indexer thread terminates. The other continues to run preventing the
container from shutting down completely.

Here is a snippet from a full JVM thread stack dump showing the Lucene Indexer thread running twice.

"JSPWiki Lucene Indexer" prio=5 tid=0x00562f30 nid=0x1de0400 waiting on condition [f09ef000..f09efaa0]
        at java.lang.Thread.sleep(Native Method)
        at com.ecyrd.jspwiki.util.WikiBackgroundThread.run(WikiBackgroundThread.java:118)

"JSPWiki Lucene Indexer" prio=5 tid=0x00556080 nid=0x19cba00 waiting on condition [f09ce000..f09ceaa0]
        at java.lang.Thread.sleep(Native Method)
        at com.ecyrd.jspwiki.util.WikiBackgroundThread.run(WikiBackgroundThread.java:118)



----

Adding my name.

--Glenn Nielsen, 01-Nov-2006


----

It seems that in Tomcat 4.1.31 you are not guaranteed during ServletContext startup that you will always get the exact same ServletContext object. This was causing both the WikiServlet.java and WikiServletFilter.java init() methods to trigger creation of a new WikiEngine when they called WikiEngine.getInstance().

The uploaded patch gets rid of the static Hashtable for storing the WikiEngine intances and instead stores each respective WikiEngine instance as an attribute in the Container ServletContext.

--Glenn NIelsen, 25-Nov-2006

----

Incorporated in 2.4.82.  Thanks!