Alexandru Neaţă created CAMEL-19397:
---------------------------------------

             Summary: SimpleLRUCache is not thread-safe
                 Key: CAMEL-19397
                 URL: https://issues.apache.org/jira/browse/CAMEL-19397
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 4.0-M3, 3.20.5
            Reporter: Alexandru Neaţă


SimpleLRUCache is not thread-safe, but it is used in various multi-threaded 
places. 

Examples are several 
[IdempotentRepository][[https://github.com/apache/camel/blob/main/core/camel-api/src/main/java/org/apache/camel/spi/IdempotentRepository.java]|https://github.com/apache/camel/blob/main/core/camel-api/src/main/java/org/apache/camel/spi/IdempotentRepository.java]
 implementations as:

* 
[MemoryIdempotentRepository][https://github.com/apache/camel/blob/main/core/camel-support/src/main/java/org/apache/camel/support/processor/idempotent/MemoryIdempotentRepository.java#L41]

* 
[FileIdempotentRepository][https://github.com/apache/camel/blob/main/core/camel-support/src/main/java/org/apache/camel/support/processor/idempotent/FileIdempotentRepository.java#L93]

* 
[KafkaIdempotentRepository][[https://github.com/apache/camel/blob/camel-3.20.x/components/camel-kafka/src/main/java/org/apache/camel/processor/idempotent/kafka/KafkaIdempotentRepository.java#L269]]

The problem with these is that the size limit of the cache is not respected (we 
have a memory leak).

To reproduce the bug, the following sample project can be used: 
[https://github.com/alex-nt/issues-java/tree/main/camel/kafka-idempotent]

Discussion about the issue can be read here: 
https://camel.zulipchat.com/#narrow/stream/257298-camel/topic/Kafka.20idempotent.20Repository.20not.20threadsafe



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to