Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-2692

Multithreading bug: getBody sporadically returns null

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.2, 2.3.0
    • 1.6.3, 2.3.0
    • camel-core
    • None
    • Windows 7 64 bit, JDK 1.6.0_20

    Description

      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:/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()
      }
      });

      Attachments

        1. news_20100502000001.zip
          242 kB
          Roland Knight

        Activity

          People

            davsclaus Claus Ibsen
            scrutinizer Roland Knight
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: