TitleReferenceManager causes ConcurrentModificationException if refmgr.ser is missing
Date10-May-2005 16:19:20 EEST
VersionJSPWiki v2.2.7-beta
SubmitterAKohlbecker
Bug criticalityFatalBug
Browser version
Bug statusClosedBug
PageProvider usedJDBCPageProvider
Servlet ContainerTomcat 5.5
Operating System
URL
Java versionjdk 1.5.0

occures if refmgr.ser is missing

Symtom:#


2005-05-10 11:07:12,390 [http-8080-Processor3] INFO com.ecyrd.jspwiki.ReferenceManager  - Unable to unserialize old refmgr information, rebuilding database: D:\eclipse_workspace\DiversityWorkbenchWeb\WebContent\wiki\JSPWiki\tmp\refmgr.ser (Das System kann die angegebene Datei nicht finden)
2005-05-10 11:10:01,890 [http-8080-Processor3] INFO com.ecyrd.jspwiki.FileUtil  - JDK 1.4 detected.  Using NIO library.
2005-05-10 11:10:02,046 [http-8080-Processor3] FATAL com.ecyrd.jspwiki.WikiEngine  - Failed to start managers.
java.util.ConcurrentModificationException
	at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1031)
	at java.util.TreeMap$KeyIterator.next(TreeMap.java:1058)
	at com.ecyrd.jspwiki.ReferenceManager.initialize(ReferenceManager.java:225)
	at com.ecyrd.jspwiki.WikiEngine.initReferenceManager(WikiEngine.java:553)
	at com.ecyrd.jspwiki.WikiEngine.initialize(WikiEngine.java:494)
	at com.ecyrd.jspwiki.WikiEngine.<init>(WikiEngine.java:381)
	at com.ecyrd.jspwiki.WikiEngine.getInstance(WikiEngine.java:277)
	at com.ecyrd.jspwiki.WikiEngine.getInstance(WikiEngine.java:233)
	at org.apache.jsp.Wiki_jsp.jspInit(org.apache.jsp.Wiki_jsp:18)
	at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:80)
	at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:145)
	at org.apache.jasper.servlet.JspServletWrapper.getDependants(JspServletWrapper.java:248)
	at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:389)
	at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:315)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)
	
if the ReferenceManager is Unable to unserialize old refmgr information because the file is lost it loopes all pages trying to rebuild the refmgr information. During this loop it seems if the pages Collection is modified while iterating. this causes an exeption!

Bugfix#

ReferenceManager.initialize() has been modified to use a copy of the pages instead of the original Collection.

modified code snipped starting at line 222:


	buildKeyLists( pages );
	           
	WikiPage[] pagesCopy = (WikiPage[])pages.toArray(new WikiPage[pages.size()]);
	
	//Scan the existing pages from disk and update references in the manager.
	for(int i=0; i < pagesCopy.length; i++)
	{
	    if( pagesCopy[i] instanceof Attachment )
	    {
	        // We cannot build a reference list from the contents
	        // of attachments, so we skip them.
	    }
	    else
	    {
	        updatePageReferences( pagesCopy[i] );
	    }
	}
	serializeToDisk();



Ah, excellent, thanks. I just noticed it myself as well and started to wonder what is going on... You beat me to it ;-)

-- JanneJalkanen

Fixed for 2.2.14.

-- JanneJalkanen

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-4) was last changed on 18-May-2005 13:06 by Administrator