You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Thomas Maschutznig <tm...@gmail.com> on 2010/08/04 17:38:21 UTC

StackOverflowError on CMStateSet.

Hi,

I get a StackOverflowError when trying to parse a 50 lines, 3 nodes
deep XML file:

java.lang.StackOverflowError
	at com.sun.org.apache.xerces.internal.impl.dtd.models.CMStateSet.<init>(CMStateSet.java:85)
	at com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.lastPos(CMNode.java:107)
	at com.sun.org.apache.xerces.internal.impl.dtd.models.CMBinOp.calcLastPos(CMBinOp.java:156)
	at com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.lastPos(CMNode.java:108)

... 200 more identical lines of lastPos() and calcLastPos() ...

	at com.sun.org.apache.xerces.internal.impl.dtd.models.CMBinOp.calcLastPos(CMBinOp.java:156)
	at com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.lastPos(CMNode.java:108)
	at com.sun.org.apache.xerces.internal.impl.dtd.models.CMUniOp.calcLastPos(CMUniOp.java:127)
	at com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.lastPos(CMNode.java:108)
	at com.sun.org.apache.xerces.internal.impl.dtd.models.DFAContentModel.calcFollowList(DFAContentModel.java:816)
	at com.sun.org.apache.xerces.internal.impl.dtd.models.DFAContentModel.buildDFA(DFAContentModel.java:510)
	at com.sun.org.apache.xerces.internal.impl.dtd.models.DFAContentModel.<init>(DFAContentModel.java:253)
	at com.sun.org.apache.xerces.internal.impl.dtd.DTDGrammar.createChildModel(DTDGrammar.java:2290)
	at com.sun.org.apache.xerces.internal.impl.dtd.DTDGrammar.getElementContentModelValidator(DTDGrammar.java:1746)
	at com.sun.org.apache.xerces.internal.impl.dtd.DTDGrammar.getElementDecl(DTDGrammar.java:1290)
	at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.checkContent(XMLDTDValidator.java:1698)
	at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2034)
	at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:822)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:322)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:250)
	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
	at weblogic.xml.jaxp.RegistryDocumentBuilder.parse(RegistryDocumentBuilder.java:155)
	at com.waveset.util.XmlParser.parseString(XmlParser.java:557)
	at com.waveset.util.XmlUtil.parseString(XmlUtil.java:441)
	at com.waveset.object.PersistentObject.create(PersistentObject.java:562)
	at jsp_servlet._debug.__checkout_object._jspService(__checkout_object.java:534)
	at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
	at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
	at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
	at com.sun.idm.profiler.instrumentation.RequestTimingFilter.doFilter(RequestTimingFilter.java:76)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3393)
	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
	at weblogic.security.service.SecurityManager.runAs(Unknown Source)
	at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2140)
	at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2046)
	at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
	at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)

This happens on a BEA Weblogic, Sun jre1.5.0_11-b03 and the JVM should
have about 2 GB of heap available.
Strangely enough I do not get any error on my local machine with
glassfish and Sun jre 1.6.0_10

As far as I can tell from the manifest in xercesImpl.jar the xerces
version in use is Xerces-J 2.9.0 and xmlcommons in xml-apis are 1.3.04

Did I run into some known issues here?

cheers,
 thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: StackOverflowError on CMStateSet.

Posted by Thomas Maschutznig <tm...@gmail.com>.
Hi,

thanks all for your suggestions! Turns out, I could simply fix it by
increasing the Stacksize to 2m...
The corresponding thread in the Java forums is:
http://forums.sun.com/thread.jspa?threadID=5446909

cheers,
 thomas


-- 
f y cn rd ths y mst hv bn usng unx

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: StackOverflowError on CMStateSet.

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Setting the "balance-syntax-trees" feature [1] to true may also work, but
you need to be using the real Xerces to set it.

[1]
http://xerces.apache.org/xerces2-j/features.html#validation.balance-syntax-trees

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Chris Simmons <cp...@corefiling.com> wrote on 08/04/2010 12:16:29 PM:

>   On 04/08/10 16:38, Thomas Maschutznig wrote:
> > Hi,
> >
> > I get a StackOverflowError when trying to parse a 50 lines, 3 nodes
> > deep XML file:
> >
> > java.lang.StackOverflowError
> >    at
> com.sun.org.apache.xerces.internal.impl.dtd.models.CMStateSet.<init>
> (CMStateSet.java:85)
> >    at
> com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.lastPos
> (CMNode.java:107)
> >    at
> com.sun.org.apache.xerces.internal.impl.dtd.models.CMBinOp.calcLastPos
> (CMBinOp.java:156)
> >    at
> com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.lastPos
> (CMNode.java:108)
> >
> > ... 200 more identical lines of lastPos() and calcLastPos() ...
> >
> >    at
> com.sun.org.apache.xerces.internal.impl.dtd.models.CMBinOp.calcLastPos
> (CMBinOp.java:156)
>
> As Michael points out, you're not using the real Xerces but I have seen
> the real-deal Xerces require relatively deep stacks too.  Either way you
> can up the stack depth of your application like this
>
> java -Xss1m ...
>
> Note stack size is separate from heap size.  I didn't look any further
> into it as upping the stack did the trick.
>
> Your favourite search engine will tell you more as ever.
>
> Chris Simmons.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

Re: StackOverflowError on CMStateSet.

Posted by Chris Simmons <cp...@corefiling.com>.
  On 04/08/10 16:38, Thomas Maschutznig wrote:
> Hi,
>
> I get a StackOverflowError when trying to parse a 50 lines, 3 nodes
> deep XML file:
>
> java.lang.StackOverflowError
> 	at com.sun.org.apache.xerces.internal.impl.dtd.models.CMStateSet.<init>(CMStateSet.java:85)
> 	at com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.lastPos(CMNode.java:107)
> 	at com.sun.org.apache.xerces.internal.impl.dtd.models.CMBinOp.calcLastPos(CMBinOp.java:156)
> 	at com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.lastPos(CMNode.java:108)
>
> ... 200 more identical lines of lastPos() and calcLastPos() ...
>
> 	at com.sun.org.apache.xerces.internal.impl.dtd.models.CMBinOp.calcLastPos(CMBinOp.java:156)

As Michael points out, you're not using the real Xerces but I have seen 
the real-deal Xerces require relatively deep stacks too.  Either way you 
can up the stack depth of your application like this

java -Xss1m ...

Note stack size is separate from heap size.  I didn't look any further 
into it as upping the stack did the trick.

Your favourite search engine will tell you more as ever.

Chris Simmons.

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: StackOverflowError on CMStateSet.

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Thomas,

>From the stack trace your application is clearly not picking up Xerces-J
2.9.0. com.sun.org.apache.xerces.internal.* is Oracle's (formerly Sun's)
fork of the Apache codebase in their JDK (5 or 6). They've made all sort of
modifications to it, giving it behaviour no version of Xerces has ever had
and apparently several bugs it has never had either. This could be one of
them.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Thomas Maschutznig <tm...@gmail.com> wrote on 08/04/2010 11:38:21
AM:

> Hi,
>
> I get a StackOverflowError when trying to parse a 50 lines, 3 nodes
> deep XML file:
>
> java.lang.StackOverflowError
>    at
> com.sun.org.apache.xerces.internal.impl.dtd.models.CMStateSet.<init>
> (CMStateSet.java:85)
>    at
> com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.lastPos
> (CMNode.java:107)
>    at
> com.sun.org.apache.xerces.internal.impl.dtd.models.CMBinOp.calcLastPos
> (CMBinOp.java:156)
>    at
> com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.lastPos
> (CMNode.java:108)
>
> ... 200 more identical lines of lastPos() and calcLastPos() ...
>
>    at
> com.sun.org.apache.xerces.internal.impl.dtd.models.CMBinOp.calcLastPos
> (CMBinOp.java:156)
>    at
> com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.lastPos
> (CMNode.java:108)
>    at
> com.sun.org.apache.xerces.internal.impl.dtd.models.CMUniOp.calcLastPos
> (CMUniOp.java:127)
>    at
> com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.lastPos
> (CMNode.java:108)
>    at
>
com.sun.org.apache.xerces.internal.impl.dtd.models.DFAContentModel.calcFollowList

> (DFAContentModel.java:816)
>    at
>
com.sun.org.apache.xerces.internal.impl.dtd.models.DFAContentModel.buildDFA
> (DFAContentModel.java:510)
>    at
> com.sun.org.apache.xerces.internal.impl.dtd.models.DFAContentModel.<init>
> (DFAContentModel.java:253)
>    at
> com.sun.org.apache.xerces.internal.impl.dtd.DTDGrammar.createChildModel
> (DTDGrammar.java:2290)
>    at
>
com.sun.org.apache.xerces.internal.impl.dtd.DTDGrammar.getElementContentModelValidator

> (DTDGrammar.java:1746)
>    at
> com.sun.org.apache.xerces.internal.impl.dtd.DTDGrammar.getElementDecl
> (DTDGrammar.java:1290)
>    at
> com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.checkContent
> (XMLDTDValidator.java:1698)
>    at
>
com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement

> (XMLDTDValidator.java:2034)
>    at
> com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement
> (XMLDTDValidator.java:822)
>    at
>
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement

> (XMLNSDocumentScannerImpl.java:322)
>    at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl
> $FragmentContentDispatcher.dispatch
(XMLDocumentFragmentScannerImpl.java:1693)
>    at
>
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument

> (XMLDocumentFragmentScannerImpl.java:368)
>    at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse
> (XML11Configuration.java:834)
>    at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse
> (XML11Configuration.java:764)
>    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse
> (XMLParser.java:148)
>    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse
> (DOMParser.java:250)
>    at
> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse
> (DocumentBuilderImpl.java:292)
>    at weblogic.xml.jaxp.RegistryDocumentBuilder.parse
> (RegistryDocumentBuilder.java:155)
>    at com.waveset.util.XmlParser.parseString(XmlParser.java:557)
>    at com.waveset.util.XmlUtil.parseString(XmlUtil.java:441)
>    at com.waveset.object.PersistentObject.create
(PersistentObject.java:562)
>    at jsp_servlet._debug.__checkout_object._jspService
> (__checkout_object.java:534)
>    at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
>    at weblogic.servlet.internal.StubSecurityHelper
> $ServletServiceAction.run(StubSecurityHelper.java:226)
>    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet
> (StubSecurityHelper.java:124)
>    at weblogic.servlet.internal.ServletStubImpl.execute
> (ServletStubImpl.java:283)
>    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
>    at weblogic.servlet.internal.FilterChainImpl.doFilter
> (FilterChainImpl.java:42)
>    at
> com.sun.idm.profiler.instrumentation.RequestTimingFilter.doFilter
> (RequestTimingFilter.java:76)
>    at weblogic.servlet.internal.FilterChainImpl.doFilter
> (FilterChainImpl.java:42)
>    at weblogic.servlet.internal.WebAppServletContext
> $ServletInvocationAction.run(WebAppServletContext.java:3393)
>    at weblogic.security.acl.internal.AuthenticatedSubject.doAs
> (AuthenticatedSubject.java:321)
>    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
>    at weblogic.servlet.internal.WebAppServletContext.securedExecute
> (WebAppServletContext.java:2140)
>    at weblogic.servlet.internal.WebAppServletContext.execute
> (WebAppServletContext.java:2046)
>    at weblogic.servlet.internal.ServletRequestImpl.run
> (ServletRequestImpl.java:1366)
>    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
>    at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
>
> This happens on a BEA Weblogic, Sun jre1.5.0_11-b03 and the JVM should
> have about 2 GB of heap available.
> Strangely enough I do not get any error on my local machine with
> glassfish and Sun jre 1.6.0_10
>
> As far as I can tell from the manifest in xercesImpl.jar the xerces
> version in use is Xerces-J 2.9.0 and xmlcommons in xml-apis are 1.3.04
>
> Did I run into some known issues here?
>
> cheers,
>  thomas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org