Camel
  1. Camel
  2. CAMEL-4581

NPE using seda (with concurrentConsumers) and stream endopoints

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8.1
    • Fix Version/s: 2.7.5, 2.8.3, 2.9.0
    • Component/s: None
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      I found an issue with seda and stream endpoints.
      Using more then 1 concurrent consumers for seda and using "stream:out" as destination endopoint , I sometimes receive some NullPointerExceptions.

      This is how to reproduce the problem:

      context.addRoutes(new RouteBuilder() {
      @Override
      public void configure() throws Exception

      { from("seda:sendRequest?concurrentConsumers=10") .to("stream:out"); }


      });
      context.start();

      for ( int i = 0; i < 50000; i++ )

      { producer.sendBody("seda:sendRequest", String.format("Message %d", i)); }

      And this is one of the exceptions:

      2011-10-25 10:12:36,550 ERROR [org.apache.camel.processor.DefaultErrorHandler] - Failed delivery for exchangeId: ID-localhost-51879-1319530353835-0-48591. Exhausted after delivery attempt: 1 caught: java.lang.NullPointerException
      java.lang.NullPointerException: null
      at java.io.Writer.<init>(Writer.java:71) ~[na:1.6.0_26]
      at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:113) ~[na:1.6.0_26]
      at org.apache.camel.component.stream.StreamProducer.writeToStream(StreamProducer.java:135) ~[camel-stream-2.8.1.jar:2.8.1]
      at org.apache.camel.component.stream.StreamProducer.process(StreamProducer.java:83) ~[camel-stream-2.8.1.jar:2.8.1]
      at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50) ~[camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:114) ~[camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:284) ~[camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:109) ~[camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99) ~[camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:305) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:102) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:217) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:155) [camel-core-2.8.1.jar:2.8.1]
      at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:129) [camel-core-2.8.1.jar:2.8.1]
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_26]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_26]
      at java.lang.Thread.run(Thread.java:680) [na:1.6.0_26]

      Lorenzo

        Activity

        Hide
        Willem Jiang added a comment -

        I just checked the code, the StreamProducer is the member object of outputStream, that is the key of NPE.

        Show
        Willem Jiang added a comment - I just checked the code, the StreamProducer is the member object of outputStream, that is the key of NPE.
        Hide
        Willem Jiang added a comment -

        Applied patch into trunk, camel-2.8.x, camel-2.7.x branch.

        Show
        Willem Jiang added a comment - Applied patch into trunk, camel-2.8.x, camel-2.7.x branch.

          People

          • Assignee:
            Willem Jiang
            Reporter:
            Lorenzo Luconi Trombacchi
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development