You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Alexandru Neaţă (Jira)" <ji...@apache.org> on 2023/05/28 10:19:00 UTC

[jira] [Updated] (CAMEL-19397) SimpleLRUCache is not thread-safe

     [ https://issues.apache.org/jira/browse/CAMEL-19397?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexandru Neaţă updated CAMEL-19397:
------------------------------------
    Description: 
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]|#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]

  was:
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


> 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: 3.20.5, 4.0-M3
>            Reporter: Alexandru Neaţă
>            Priority: Minor
>
> 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]|#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)