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

NPE when using PostgresAggregationRepository

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 3.4.2
    • Fix Version/s: 3.x
    • Component/s: camel-sql
    • Labels:
      None
    • Environment:
      • Apache Camel 3.4.2
      • Spring Boot 2.3.4.RELEASE
      • Postgres database as an aggregate repository
    • Estimated Complexity:
      Unknown

      Description

      Hi,

      we are getting production errors (NPE) when using a Postgres aggregate repository and Camel code attempts to write to that table (under concurrent use):

      org.apache.camel.RuntimeCamelException: java.lang.RuntimeException: Error adding to repository lb_data_uploads with key *** at org.apache.camel.RuntimeCamelException.wrapRuntimeCamelException(RuntimeCamelException.java:52) at org.apache.camel.processor.aggregate.jdbc.JdbcAggregationRepository.add(JdbcAggregationRepository.java:142) at org.apache.camel.processor.aggregate.AggregateProcessor.doAggregationRepositoryAdd(AggregateProcessor.java:644) at org.apache.camel.processor.aggregate.AggregateProcessor.doAggregation(AggregateProcessor.java:598) at org.apache.camel.processor.aggregate.AggregateProcessor.doProcess(AggregateProcessor.java:406) at org.apache.camel.processor.aggregate.AggregateProcessor.doInOptimisticLock(AggregateProcessor.java:372) at org.apache.camel.processor.aggregate.AggregateProcessor.doProcess(AggregateProcessor.java:362) at org.apache.camel.processor.aggregate.AggregateProcessor.process(AggregateProcessor.java:320) at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:702) at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:616) at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148) at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:60) at org.apache.camel.processor.Pipeline.process(Pipeline.java:147) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:286) at org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:83) at org.apache.camel.support.AsyncProcessorSupport.process(AsyncProcessorSupport.java:40) at org.apache.camel.component.kafka.KafkaConsumer$KafkaFetchRecords.doRun(KafkaConsumer.java:346) at org.apache.camel.component.kafka.KafkaConsumer$KafkaFetchRecords.run(KafkaConsumer.java:222) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.lang.RuntimeException: Error adding to repository lb_data_uploads with key *** at org.apache.camel.processor.aggregate.jdbc.JdbcAggregationRepository$1.doInTransaction(JdbcAggregationRepository.java:176) at org.apache.camel.processor.aggregate.jdbc.JdbcAggregationRepository$1.doInTransaction(JdbcAggregationRepository.java:149) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) at org.apache.camel.processor.aggregate.jdbc.JdbcAggregationRepository.add(JdbcAggregationRepository.java:149) at org.apache.camel.processor.aggregate.jdbc.JdbcAggregationRepository.add(JdbcAggregationRepository.java:137) ... 21 common frames omitted Caused by: java.lang.NullPointerException: null at org.apache.camel.processor.aggregate.jdbc.JdbcAggregationRepository$1.doInTransaction(JdbcAggregationRepository.java:167) ... 25 common frames omitted

       

      The problematic code seems to be at JdbcAggregationRepository.java line 167:

      private static final String VERSION_PROPERTY = "CamelOptimisticLockVersion";
      ....
      long version = exchange.getProperty(VERSION_PROPERTY, Long.class);
      

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              corina.roman Corina Roman
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: