TitleJSPWiki initializing itself twice on startup - two Lucene Indexer threads started
Date01-Nov-2006 08:15:51 EET
Bug criticalityBadBug
Browser version
Bug statusClosedBug
PageProvider used
Servlet ContainerTomcat 4.1.30
Operating SystemMac OSX
Java version1.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!

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
WikiEngine.java.patch 1.9 kB 1 25-Nov-2006 21:03
« This page (revision-8) was last changed on 09-Mar-2011 20:55 by Harry Metske