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

The ehcache component creates a separate CacheManager per producer route

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.19.0
    • 2.20.0
    • camel-ehcache
    • None
    • Unknown

    Description

      The issue becomes clear if the developers declares more than one producer route with the attached ehcache config: multiple cache managers start contention of file lock and the startup fails.

       <?xml version="1.0" encoding="UTF-8"?>
      <ehcache:config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      xmlns:ehcache="http://www.ehcache.org/v3"
                      xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.3.xsd">
      
          <ehcache:persistence directory="${java.io.tmpdir}/ehcache"></ehcache:persistence>
      
          <ehcache:cache alias="cache1" uses-template="default-template">
          </ehcache:cache>
      
          <ehcache:cache alias="cache2" uses-template="default-template">
              <ehcache:expiry>
                  <ehcache:ttl unit="minutes">60</ehcache:ttl>
              </ehcache:expiry>
          </ehcache:cache>
      
          <ehcache:cache alias="cache3" uses-template="default-template">
              <ehcache:expiry>
                  <ehcache:ttl unit="minutes">1</ehcache:ttl>
              </ehcache:expiry>
          </ehcache:cache>
      
          <ehcache:cache-template name="default-template">
              <ehcache:key-type>java.lang.String</ehcache:key-type>
              <ehcache:value-type>java.io.Serializable</ehcache:value-type>
      
              <ehcache:expiry>
                  <ehcache:none/>
              </ehcache:expiry>
      
              <ehcache:resources>
                  <ehcache:heap unit="entries">1000</ehcache:heap>
                  <ehcache:disk persistent="true" unit="MB">10</ehcache:disk>
              </ehcache:resources>
          </ehcache:cache-template>
      </ehcache:config>
      

      resulting in:

      Caused by: org.ehcache.StateTransitionException: Couldn't lock rootDir: /var/folders/gf/6psxkr_n7vl_qbhw8mktqqww0000gn/T/ehcache
      	at org.ehcache.core.StatusTransitioner$Transition.failed(StatusTransitioner.java:235) ~[ehcache-3.2.2.jar:3.2.2 892e5c56c2a7100866de90dc7c2099a62fb6198b]
      	at org.ehcache.core.EhcacheManager.init(EhcacheManager.java:588) ~[ehcache-3.2.2.jar:3.2.2 892e5c56c2a7100866de90dc7c2099a62fb6198b]
      	at org.apache.camel.component.ehcache.EhcacheManager.start(EhcacheManager.java:66) ~[camel-ehcache-2.19.0.jar:2.19.0]
      	at org.apache.camel.component.ehcache.EhcacheEndpoint.doStart(EhcacheEndpoint.java:65) ~[camel-ehcache-2.19.0.jar:2.19.0]
      	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:236) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.processor.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:1447) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:44) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:31) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.processor.interceptor.DefaultChannel.doStart(DefaultChannel.java:156) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:80) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.impl.RouteService.startChildService(RouteService.java:364) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.impl.RouteService.doWarmUp(RouteService.java:196) ~[camel-core-2.19.0.jar:2.19.0]
      	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:145) ~[camel-core-2.19.0.jar:2.19.0]
      	... 28 common frames omitted
      

      Attachments

        Activity

          People

            lb Luca Burgazzoli
            santa.85@gmail.com Marco Santarelli
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: