Community
Participate
Working Groups
Build Identifier: Eclipse Build id: 20090920-1017 / BIRT Runtime 2.5.1 + 2.5.2 When passing XML-data to the IRunTask in a multi-threaded application, some of the resulting .rptdocument files will be corrupted. The error only occures when passing an InputStream using the setAppContext method: ctxMap.put("org.eclipse.birt.report.data.oda.xml.inputStream", new FileInputStream("data.xml")); ctxMap.put("org.eclipse.birt.report.data.oda.xml.closeInputStream", new Boolean(true)); task.setAppContext(ctxMap); This warning will be written to the log: "WARNUNG: Exceptions occur during xml parsing" (see attachments for stackstrace) Reproducible: Sometimes Steps to Reproduce: 1. Run the sample application in the attachments (use the -Xmx1024m VM-Argument to avoid our of memory errors 2. Wait till the log shows the this warning: WARNUNG: Exceptions occur during xml parsing 3. Kill the sample application process 4. Analyze the generated rptdocument files (sort by ascending file size to find corrupted files)
Created attachment 170172 [details] Stacktrace
Created attachment 170173 [details] Sample Application (Testcase) Sample Application that reproduces the bug in most of the cases. Use the Xmx1024m VM-option to ovoid an out of memory error.
Thanks for the simple but convinced test case, I reproduced it and finally found out the cause: In multihreading scenario, the appContext of one ODA connection may override the appContext of another ODA connection. need fix. However, there's a minor issue in your test case code. Totally 500 tasks are runned in 500 threads and 500 BIRT document files should be outputted. But each time I run the code, only 49x(x=0,1...9) files are generated. It seems that UUID.randomUUID() is not threadsafe. If I put it into a static synchronized method like: private synchronized static UUID getUUID( ) { return UUID.randomUUID( ); } then the outputted files count is always 500.
The problem is from odaconsumer, forward it to Linda.
It now handles the use case when an appContext is passed in for an ODA connection.
Verified with daily build 2.6.1.v20100806-1040