[ https://issues.apache.org/activemq/browse/CAMEL-2692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=59216#action_59216 ]
Claus Ibsen commented on CAMEL-2692: ------------------------------------ I cannot reproduce the problem you may have {code} public class SplitXPathParallelBigFileIssueTest extends ContextTestSupport { public void testSplitXPathParallelBigFileIssue() throws Exception { getMockEndpoint("mock:result").expectedMessageCount(144); assertMockEndpointsSatisfied(); } @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from("file:news/?noop=true") .split(new XPathBuilder("//article")) .parallelProcessing() .process(new Processor() { public void process(Exchange exchange) throws Exception { Document doc = exchange.getIn().getBody(Document.class); assertNotNull(doc); String id = doc.getFirstChild().getAttributes().getNamedItem("id").getTextContent(); System.out.println(id); //String txt = exchange.getContext().getTypeConverter().convertTo(String.class, doc.getFirstChild()); } }).to("mock:result") .end(); } }; } } {code} I can always read the 144 articles from the xml file. {code} 2010-05-06 09:17:44,748 [main ] INFO DefaultCamelContext - Apache Camel (CamelContext: camel-1) is starting 2010-05-06 09:17:44,749 [main ] INFO DefaultCamelContext - JMX is disabled. Using DefaultManagementStrategy. 2010-05-06 09:17:45,112 [main ] INFO FileEndpoint - Endpoint is configured with noop=true so forcing endpoint to be idempotent as well 2010-05-06 09:17:45,113 [main ] INFO FileEndpoint - Using default memory based idempotent repository with cache max size: 1000 2010-05-06 09:17:45,116 [main ] INFO DefaultCamelContext - Route: route1 started and consuming from: Endpoint[file://news/?noop=true] 2010-05-06 09:17:45,117 [main ] INFO DefaultCamelContext - Started 1 routes 2010-05-06 09:17:45,118 [main ] INFO DefaultCamelContext - Apache Camel (CamelContext: camel-1) started in 371 millis 2010-05-06 09:17:45,121 [main ] INFO MockEndpoint - Asserting: Endpoint[mock://result] is satisfied _2744977482 _2744977610 _2744977541 _2744977483 _2744977566 _2744977496 _2744977557 _2744977581 _2744977585 _2744977661 _2744977576 _2744977632 _2744977675 _2744977612 _2744977682 _2744977685 _2744977833 _2744977734 _2744977760 _2744977707 _2744977798 _2744977791 _2744977840 _2744977677 _2744977887 _2744977842 _2744977906 _2744977913 _2744977737 _2744977876 _2744977930 _2744977901 _2744977869 _2744977681 _2744977938 _2744977962 _2744977986 _2744977987 _2744977895 _2744977977 _2744977997 _2744978016 _2744978026 _2744978048 _2744978065 _2744978057 _2744978064 _2744978076 _2744978068 _2744978088 _2744978084 _2744978090 _2744978097 _2744978091 _2744978103 _2744978112 _2744978114 _2744978122 _2744978130 _2744978131 _2744978160 _2744978161 _2744978170 _2744978172 _2744978139 _2744978196 _2744978211 _2744978205 _2744978222 _2744978195 _2744978245 _2744978326 _2744978318 _2744978340 _2744978223 _2744978335 _2744978355 _2744978368 _2744978369 _2744978384 _2744978401 _2744978382 _2744978408 _2744978411 _2744978415 _2744978452 _2744978458 _2744978462 _2744978440 _2744978471 _2744978439 _2744978460 _2744978485 _2744978497 _2744978510 _2744978511 _2744978512 _2744978536 _2744978517 _2744978552 _2744978569 _2744978577 _2744978579 _2744978583 _2744978592 _2744978635 _2744978609 _2744978642 _2744978611 _2744978621 _2744978598 _2744978606 _2744978647 _2744978694 _2744978679 _2744978692 _2744978719 _2744978732 _2744978759 _2744978730 _2744978763 _2744978886 _2744978838 _2744978895 _2744978900 _2744978903 _2744978911 _2744978918 _2744978810 _2744978800 _2744978963 _2744978968 _2744978972 _2744978765 _2744978982 _2744978948 _2744978997 _2744978883 _2744978801 _2744978782 _2744978821 _2744978989 _2744978950 _2744978985 2010-05-06 09:17:47,316 [main ] INFO DefaultCamelContext - Apache Camel (CamelContext:camel-1) is shutting down 2010-05-06 09:17:47,317 [main ] INFO DefaultShutdownStrategy - Starting to graceful shutdown 1 routes (timeout 10 seconds) 2010-05-06 09:17:47,320 [ - ShutdownTask] INFO DefaultShutdownStrategy - Route: route1 suspended and shutdown deferred, was consuming from: Endpoint[file://news/?noop=true] 2010-05-06 09:17:47,320 [ - ShutdownTask] INFO DefaultShutdownStrategy - Route: route1 shutdown complete. 2010-05-06 09:17:47,321 [main ] INFO DefaultShutdownStrategy - Graceful shutdown of 1 routes completed in 0 seconds 2010-05-06 09:17:47,321 [main ] INFO DefaultInflightRepository - Shutting down with no inflight exchanges. 2010-05-06 09:17:47,322 [main ] INFO DefaultCamelContext - Apache Camel (CamelContext: camel-1) is shutdown in 6 millis {code} > Multithreading bug: getBody sporadically returns null > ----------------------------------------------------- > > Key: CAMEL-2692 > URL: https://issues.apache.org/activemq/browse/CAMEL-2692 > Project: Apache Camel > Issue Type: Bug > Components: camel-core > Affects Versions: 2.3.0 > Environment: Windows 7 64 bit, JDK 1.6.0_20 > Reporter: Roland Knight > Attachments: news_20100502000001.zip > > > Note that the only workaround for this bug is to remove the > parallelProcessing() call in the builder. > I have a simple route that processes a file by splitting on a tag and > processing the DOM of each split message. The problem is that getBody is > randomly returning null but ONLY when using the parallelProcessing feature of > split. For some runs of the same XML file, the error does not occur at all > (the file is about 2MB of data), others it will happen once or twice. I am > currently using the latest 2.3-SNAPSHOT. > Also note, that after detecting the null, I tried calling > getBody(String.class) - this also may return null. Sometimes it does return > the proper XML. > Route configuration that reproduces the problem (my input XML is about 2MB > with about 500 article tags): > public void configure() throws Exception { > from("file:D:/inbox") > .split(new XPathBuilder("//article")) > .parallelProcessing() // remove this line > getBody below never returns null > .process(new Processor() { > public void process(Exchange exchange) throws Exception { > Message inMessage = exchange.getIn(); > org.w3c.dom.Document domDocument = > inMessage.getBody(org.w3c.dom.Document.class); > if (domDocument == null) { > log("Null body"); > } else { > // process DOM here > } > } > }) > .end() > } > }); -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.