You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2001/05/08 12:42:57 UTC

[Bug 1649] New - Thread sync issue using validation feature during DOM parsing

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1649

*** shadow/1649	Tue May  8 03:42:57 2001
--- shadow/1649.tmp.29497	Tue May  8 03:42:57 2001
***************
*** 0 ****
--- 1,116 ----
+ +============================================================================+
+ | Thread sync issue using validation feature during DOM parsing              |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 1649                        Product: Xerces-J                |
+ |       Status: NEW                         Version: 1.3.1                   |
+ |   Resolution:                            Platform: PC                      |
+ |     Severity: Normal                   OS/Version: Windows NT/2K           |
+ |     Priority: Medium                    Component: DOM                     |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: xerces-j-dev@xml.apache.org                                  |
+ |  Reported By: henrik.stahl@iconmedialab.se                                 |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ When turning on validation in Xerces 1.3.1, the API 
+ prints out error messages stating for example that 
+ "validator for e-dtype not found" (approx). This only 
+ happens if I call the parser from several concurrent 
+ threads for some time and appears intermittently. 
+ 
+ The provided example document and DTD will cause 
+ this behaviour. Sample Java code to provoke the bug
+ is also included. Compile the class and invoke as
+ "java XMLTest <threads> <iterations/thread>". When
+ threads == 1, no problem is seen. Increase
+ threads to 10 and iterations to 500 and the problem
+ should appear. If not, increase even more.
+ 
+ My environment:
+ Xerces 1.3.1, J2SE 1.3 (both client and server JVM),
+ NT4SP6 and Solaris 8.0.
+ 
+ test.dtd: 
+ === 
+ <?xml version='1.0' encoding='UTF-8' ?> 
+ <!ELEMENT ROOTID (OrderNumber, User)> 
+ <!ATTLIST ROOTID ProcessCode (BuyOrder) #REQUIRED > 
+ <!ELEMENT OrderNumber (#PCDATA)> 
+ <!ATTLIST OrderNumber e-dtype NMTOKEN  #FIXED 'NMTOKEN' > 
+ <!ELEMENT User (#PCDATA)> 
+ 
+ test.xml 
+ === 
+ <?xml version="1.0"?> 
+ <!DOCTYPE ROOTID SYSTEM "file:///dtd/test.dtd"> 
+ <ROOTID ProcessCode="BuyOrder"> 
+         <OrderNumber>QWE123123</OrderNumber> 
+         <User>ABC123</User> 
+ </ROOTID > 
+ 
+ XMLTest.java
+ ===
+ import java.io.*;
+ import org.xml.sax.*;
+ import org.w3c.dom.*;
+ /**
+  * Xerces stress parsing bug provoker.
+  * @author: Henrik St�hl
+  * @company: Icon Medialab AB
+  * @version: 1.0
+  */
+ class XMLTest implements Runnable {
+ 	private static int ITERATIONS = 10;
+ 	private static int THREADS = 2;
+ 	private org.apache.xerces.parsers.DOMParser parser = new 
+ org.apache.xerces.parsers.DOMParser();
+ public static void main(java.lang.String[] args) throws Exception {
+ 
+ 	if (args.length > 0) {
+ 		THREADS = (new Integer(args[0])).intValue();
+ 	}
+ 	if (args.length > 1) {
+ 		ITERATIONS = (new Integer(args[1])).intValue();
+ 	}
+ 
+ 	int i = 0;
+ 	XMLTest test[] = new XMLTest[THREADS];
+ 	Thread t[] = new Thread[THREADS];
+ 
+ 	for (i = 0; i < THREADS; i++) {
+ 		test[i] = new XMLTest();
+ 		t[i] = new Thread(test[i], "T" + i);
+ 	}
+ 
+ 	for (i = 0; i < THREADS; i++) {
+ 		t[i].start();
+ 	}
+ 
+ 	for (i = 0; i < THREADS; i++) {
+ 		t[i].join();
+ 	}
+ 
+ }
+ public void run() {
+ 	try {
+ 		parser.setFeature("http://xml.org/sax/features/validation", 
+ true);
+ 	} catch (Exception e) {
+ 		e.printStackTrace();
+ 		return;
+ 	}
+ 
+ 	for (int i = 0; i < ITERATIONS; i++) {
+ 		try {
+ 			InputSource input = new InputSource(new FileInputStream
+ ("test.xml"));
+ 			parser.parse(input);
+ 			Document doc = parser.getDocument();
+ 		} catch (Exception e) {
+ 			e.printStackTrace();
+ 		}
+ 	}
+ }
+ }

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