United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6976938 StackOverflowError by com.sun.xml.stream.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next
JDK-6976938 : StackOverflowError by com.sun.xml.stream.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next

Details
Type:
Bug
Submit Date:
2010-08-13
Status:
Closed
Updated Date:
2012-04-25
Project Name:
JDK
Resolved Date:
2011-01-04
Component:
xml
OS:
solaris_10
Sub-Component:
javax.xml.stream
CPU:
sparc
Priority:
P5
Resolution:
Not an Issue
Affected Versions:
1.0
Fixed Versions:
5.0-pool

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Relates:

Sub Tasks

Description
Operating System
----------------------
SPARC Solaris 10 (but reproduceible at any OS)
Due to bigger Solaris OS default of pagesize(1) of 8k, the issue is 
faster reproduceible at sparc architecture.

StAX Version
----------------------
issue persist at any StAX (eg.lastest JDK6 or Glassfish or latest StAX 1.0.2 from dev.java.net)

Description
----------------------
Customer is running StAX at Application Server to read XML files.
Quite similar to CR#6440214 the StAX scanner produce a java.lang.StackOverflowError while 
reading valid XML files, in case the text content of a XML element contains many lines like "< ... >".
As more new lines with "< ... >" will be added, as bigger java stack is consumed, caused by the StAX scanner.
However the given workaround from CR#6440214 to set "IS_COALESCING, Boolean.FALSE" do not work
in our test case. The seen error message is additional a bit different which is the reason for another bugreport.
Setting IS_COALESCING to FALSE cause only a very small effect to reduce the amound of
used stack size by just a few bytes.

Testcase attached 
----------------------
- sample XML file which cause the issue
- the runnable testcase

Howto run the testcase
----------------------
- download and extract latest ant if you dont have ant installed
- Please unzip the test case and run on sparc to reproduce the error
$ ant -Dplatform.home=/your/path/to/jdk1.5.0_xx -Drun.jvmargs="-server" clean test

- Please run on sparc this command to prevent the error
$ ant -Dplatform.home=/your/path/to/jdk1.5.0_xx -Drun.jvmargs="-server -Xss800k" clean test

- To simulate the error with Solaris x86, use ppgsz(1) 
call pagesize -a and pickup a valid pagesize bigger then 8k and call the ant command at x86 like this
$ ppgsz -o stack=2097152 ant -Dplatform.home=/opt/jdk1.5.0_22-32 -Drun.jvmargs="-server" clean test 

Error Messages
-----------------------
java.lang.StackOverflowError
	at com.sun.xml.stream.XMLEntityReaderImpl.scanName(XMLEntityReaderImpl.java:700)
	at com.sun.xml.stream.XMLDocumentFragmentScannerImpl.scanEntityReference(XMLDocumentFragmentScannerImpl.java:1723)
	at com.sun.xml.stream.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2936)
	at com.sun.xml.stream.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2819)
	at com.sun.xml.stream.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2962)
	at com.sun.xml.stream.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2819)
	at com.sun.xml.stream.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2962)
	at com.sun.xml.stream.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2819)
	at com.sun.xml.stream.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2962)
	at com.sun.xml.stream.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2819)
	at com.sun.xml.stream.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2962)
...
...

                                    

Comments
WORK AROUND

Issue does not happen in case the valid xml text data is stored
within <![CDATA[ ... ]]> text.
However the workaround is not usable for many customers,
in case they read valid XML from external resources.

The codehaus woodstox implementation dont have this issue.
                                     
2010-08-13
EVALUATION

Note that this issue has been fixed in both sjsxp and jaxp 1.4 by 11/08/10. It's shown on bugs.sun.com (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6976938) as still open because that for jaxp 1.4 was created as a sub-CR.
                                     
2010-12-01
EVALUATION

The impacted classes for this fix do not exist in JDK5 the reason being, this functionality is provided with a separate sjsxp.jar and has been incorporated into JDK only since JDK6. Hence this fix is not applicable to JDK5. 

Closing the SubCR.
                                     
2011-01-04



Hardware and Software, Engineered to Work Together