Details
Description
In my application I have a route with an aggregation using an aggregation repository ClusteredJdbcAggregationRepository and completionTimeout. This route is part of a micro service that can be scaled. From time to time, the micro service does not start due to a NPE:
Caused by: java.lang.NullPointerException: Cannot invoke "org.apache.camel.Exchange.getProperty(org.apache.camel.ExchangePropertyKey, Object, java.lang.Class)" because "exchange" is null at org.apache.camel.processor.aggregate.AggregateProcessor.restoreTimeoutMapFromAggregationRepository(AggregateProcessor.java:920) ~[camel-core-processor-3.20.1.jar:3.20.1]
In my case the exchange is null because it has already been processed by one of the micro service instance.
The relevant code is in https://github.com/apache/camel/blob/camel-3.20.1/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java#L920
for (String key : keys) { Exchange exchange = aggregationRepository.get(camelContext, key); // grab the timeout value long timeout = exchange.getProperty(ExchangePropertyKey.AGGREGATED_TIMEOUT, 0L, long.class);
The null check is missing. It's not a problem when aggregation repository is not shared among instance like LevelDB, but it is when it's shared like JDBC.
Attachments
Issue Links
- links to