Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317321 - DeploymentDescriptorPropertyCache can enter an infinite loop
Summary: DeploymentDescriptorPropertyCache can enter an infinite loop
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.2.1   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard: WI 49990
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-18 13:03 EDT by Nick Sandonato CLA
Modified: 2011-07-14 08:08 EDT (History)
1 user (show)

See Also:
thatnitind: review+


Attachments
patch (2.05 KB, patch)
2010-06-18 13:06 EDT, Nick Sandonato CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Sandonato CLA 2010-06-18 13:03:30 EDT
The singleton DeploymentDescriptorPropertyCache can get stuck in an infinite loop because of concurrency issues accessing the resolvedMap field with #getWebXMLPath().

Java callstack:
at java/util/HashMap.rehash(Bytecode PC:97(Compiled Code))
at java/util/HashMap.rehash(Bytecode PC:6(Compiled Code))
at java/util/HashMap.putImpl(Bytecode PC:6(Compiled Code))
at java/util/HashMap.put(Bytecode PC:3(Compiled Code))
at org/eclipse/jst/jsp/core/internal/contenttype/DeploymentDescriptorPropertyCache.getWebXMLPath(Bytecode PC:88(Compiled Code))
at org/eclipse/jst/jsp/core/internal/contenttype/DeploymentDescriptorPropertyCache.getCachedDescriptor(Bytecode PC:2(Compiled Code))
at org/eclipse/jst/jsp/core/internal/contenttype/DeploymentDescriptorPropertyCache.getPropertyGroups(Bytecode PC:11(Compiled Code))
at org/eclipse/jst/jsp/core/internal/contentmodel/tld/TLDCMDocumentManager.handlePreludes(Bytecode PC:28(Compiled Code))
at org/eclipse/jst/jsp/core/internal/contentmodel/tld/TLDCMDocumentManager$DirectiveStructuredDocumentRegionHandler.nodeParsed(Bytecode PC:14(Compiled Code))
at org/eclipse/wst/xml/core/internal/parser/XMLSourceParser.fireNodeParsed(Bytecode PC:62(Compiled Code))
at org/eclipse/jst/jsp/core/internal/parser/JSPSourceParser.parseNodes(Bytecode PC:62(Compiled Code))
at org/eclipse/wst/xml/core/internal/parser/XMLSourceParser.getDocumentRegions(Bytecode PC:3(Compiled Code))
at org/eclipse/wst/sse/core/internal/text/StructuredDocumentReParser._core_reparse_text(Bytecode PC:3(Compiled Code))
at org/eclipse/wst/sse/core/internal/text/StructuredDocumentReParser.core_reparse(Bytecode PC:3(Compiled Code))
at org/eclipse/jst/jsp/core/internal/parser/JSPReParser.reparse(Bytecode PC:162(Compiled Code))
at org/eclipse/wst/sse/core/internal/text/StructuredDocumentReParser.reparse(Bytecode PC:64(Compiled Code))
at org/eclipse/wst/sse/core/internal/text/BasicStructuredDocument.updateModel(Bytecode PC:25(Compiled Code))
at org/eclipse/wst/sse/core/internal/text/BasicStructuredDocument.internalReplaceText(Bytecode PC:89(Compiled Code))
at org/eclipse/wst/sse/core/internal/text/BasicStructuredDocument.replaceText(Bytecode PC:10(Compiled Code))
at org/eclipse/wst/sse/core/internal/text/BasicStructuredDocument.set(Bytecode PC:10(Compiled Code))
at org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.setDocumentContent(Bytecode PC:190(Compiled Code))
at org/eclipse/core/internal/filebuffers/ResourceTextFileBuffer.initializeFileBufferContent(Bytecode PC:120(Compiled Code))
at org/eclipse/core/internal/filebuffers/ResourceFileBuffer.create(Bytecode PC:144(Compiled Code))
at org/eclipse/core/internal/filebuffers/TextFileBufferManager.connect(Bytecode PC:99(Compiled Code))
at org/eclipse/wst/sse/core/internal/FileBufferModelManager.getModel(Bytecode PC:84(Compiled Code))
at org/eclipse/wst/sse/core/internal/model/ModelManagerImpl._doCommonGetModel(Bytecode PC:17(Compiled Code))
at org/eclipse/wst/sse/core/internal/model/ModelManagerImpl._commonGetModel(Bytecode PC:141(Compiled Code))
at org/eclipse/wst/sse/core/internal/model/ModelManagerImpl._commonGetModel(Bytecode PC:15(Compiled Code))
at org/eclipse/wst/sse/core/internal/model/ModelManagerImpl.getModelForRead(Bytecode PC:15(Compiled Code))
at org/eclipse/jst/jsp/core/internal/java/search/JSPSearchDocument.getJSPTranslation(Bytecode PC:15(Compiled Code))
at org/eclipse/jst/jsp/core/internal/java/search/JSPSearchDocument.getPath(Bytecode PC:15(Compiled Code))
at org/eclipse/jst/jsp/core/internal/java/search/JavaSearchDocumentDelegate.<init>(Bytecode PC:2(Compiled Code))
at org/eclipse/jst/jsp/core/internal/java/search/JSPSearchSupport.createSearchDocument(Bytecode PC:2(Compiled Code))
at org/eclipse/jst/jsp/core/internal/java/search/JSPSearchSupport.addJspFile(Bytecode PC:55(Compiled Code))
at org/eclipse/jst/jsp/core/internal/java/search/JSPIndexManager$ProcessFilesJob.run(Bytecode PC:191)
at org/eclipse/core/internal/jobs/Worker.run(Bytecode PC:31)
Comment 1 Nick Sandonato CLA 2010-06-18 13:06:42 EDT
Created attachment 172237 [details]
patch

Allowing threads to access the map more safely.
Comment 2 Nick Sandonato CLA 2010-06-24 11:41:06 EDT
Patch released to maintenance and HEAD.
Comment 3 Aaron Digulla CLA 2011-07-14 08:08:29 EDT
Probably related: I just got a deadlock in HashMap.get()

"Worker-8" prio=10 tid=0x00000000477b9000 nid=0x525b runnable [0x00007f97353c1000]
   java.lang.Thread.State: RUNNABLE
        at java.util.HashMap.get(HashMap.java:303)
        at org.eclipse.jst.jsp.core.internal.contenttype.DeploymentDescriptorPropertyCache.getWebXMLPath(DeploymentDescriptorPropertyCache.java:924)
        - locked <0x00000000cf3b50d0> (a java.lang.Object)
        at org.eclipse.jst.jsp.core.internal.contenttype.DeploymentDescriptorPropertyCache.getCachedDescriptor(DeploymentDescriptorPropertyCache.java:800)
        at org.eclipse.jst.jsp.core.internal.contenttype.DeploymentDescriptorPropertyCache.getPropertyGroups(DeploymentDescriptorPropertyCache.java:873)

This is with the plugin org.eclipse.jst.jsp.core_1.2.400.v201105162116.jar which comes with 3.7. From the qualifier, I guess the fix isn't included.