java.lang.IllegalStateException: Shutdown in progress

Terracotta Project Issue Tracker | Mitch Wright | 4 years ago
  1. 0

    EhCache 2.6 automatically/independently shutting down

    terracotta.org | 11 months ago
    java.lang.IllegalStateException: Shutdown in progress
  2. 0

    Terracotta Project Issue Tracker

    terracotta.org | 11 months ago
    java.lang.IllegalStateException: Shutdown in progress
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Overview: From various bits of evidence I've observed, in 2.6.0 (at least) it looks like a shutdown hook is being registered automatically and that EhCache is shutting itself down independently of whatever else the application might be trying to do. From the documentation, this behaviour has changed from 2.4, where the hook could be enabled but was off by default: http://www.ehcache.org/documentation/2.4/user-guide/shutdown#the-shutdown-hook Iin my testing, setting net.sf.ehcache.enableShutdownHook=false had no (obvious) effect (in 2.6.0). To support environments where the application is using a hook to shut itself and its resources down gracefully (either directly or indirectly via a container), it seems that EhCache should provide a switch/option (such as it did in earlier releases) to disable automated cleanup. Then disabled, EhCache would on rely on the application to indicate (by calling the shutdown method on the CacheManagers) that is it through using the caches. Background: I noticed the following messages appearing in the log regarding EhCache resources being shutdown, regardless of whether the CacheManager.shutdown was being call explicitly or not: 20:17:54.894 [Thread-2] DEBUG o.t.modules.ehcache.LocalVMResources - Unregistering Cache with name: local-shadow-cache-for-TestCache-uuid-mwright-Precision-M4700/127.0.1.1-8b2e1497-a1a5-4004-91a2-d55a5ff753cc 20:17:54.894 [Thread-21] INFO o.t.m.e.s.s.EhcacheSMLocalStore - Ignoring getOffHeapSize as inner cache is not alive. 20:17:54.899 [Thread-21] INFO EhCacheTest - Cache statistics: Total [ 14496], In memory [ 0], evictions [0] 2013-02-06 20:17:55,789 INFO - Channel ChannelID=[19] closed. 20:17:55.894 [Out of band notifier - 0] INFO n.s.e.terracotta.TerracottaClient - Thread [Out of band notifier - 0] [cacheManager: 'EhCacheTest']: ClusterNode [id=ClientID[19]] went offline (currentNode=ClientID[19]) 20:17:55.895 [Out of band notifier - 1] INFO n.s.e.terracotta.TerracottaClient - Thread [Out of band notifier - 1] [cacheManager: 'EhCacheTest']: ClusterNode [id=ClientID[19]] left the cluster (currentNode=ClientID[19]) I discovered, quite accidentally, that indeed a shutdown hook was being registered by EhCache, when my test harness exited during start up, causing this stack trace to be generated: java.lang.IllegalStateException: Shutdown in progress at java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:39) at java.lang.Runtime.addShutdownHook(Runtime.java:192) at com.tc.util.CommonShutDownHook.addShutdownHook(CommonShutDownHook.java:49) at com.tc.object.DistributedObjectClient.setLoggerOnExit(DistributedObjectClient.java:1089) at com.tc.object.DistributedObjectClient.start(DistributedObjectClient.java:839) at com.tc.object.bytecode.ManagerImpl$2.execute(ManagerImpl.java:284) at com.tc.lang.StartupHelper.startUp(StartupHelper.java:39) at com.tc.object.bytecode.ManagerImpl.startClient(ManagerImpl.java:302) at com.tc.object.bytecode.ManagerImpl.init(ManagerImpl.java:212) at com.tc.object.bytecode.ManagerImpl.init(ManagerImpl.java:194) at com.tc.object.bytecode.hook.impl.DSOContextImpl.createStandaloneContext(DSOContextImpl.java:186) at com.terracotta.express.StandaloneL1Boot.call(StandaloneL1Boot.java:211) at com.terracotta.express.ClientImpl.<init>(ClientImpl.java:369) at com.terracotta.express.ClientFactoryImpl.newClient(ClientFactoryImpl.java:286) at com.terracotta.express.ClientFactoryImpl.createClient(ClientFactoryImpl.java:279) at com.terracotta.express.ClientFactoryImpl.createDedicatedRejoinClient(ClientFactoryImpl.java:170) at org.terracotta.express.ClientFactoryExtras.createDedicatedRejoinClient(ClientFactoryExtras.java:40) at net.sf.ehcache.terracotta.StandaloneTerracottaClusteredInstanceFactory.<init>(StandaloneTerracottaClusteredInstanceFactory.java:35) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at net.sf.ehcache.util.ClassLoaderUtil.createNewInstance(ClassLoaderUtil.java:92) at net.sf.ehcache.terracotta.TerracottaClusteredInstanceHelper.newClusteredInstanceFactory(TerracottaClusteredInstanceHelper.java:176) at net.sf.ehcache.terracotta.TerracottaClient.createNewClusteredInstanceFactory(TerracottaClient.java:186) at net.sf.ehcache.terracotta.TerracottaClient.access$1500(TerracottaClient.java:52) at net.sf.ehcache.terracotta.TerracottaClient$RejoinWorker.doRejoin(TerracottaClient.java:430) at net.sf.ehcache.terracotta.TerracottaClient$RejoinWorker.run(TerracottaClient.java:338) at java.lang.Thread.run(Thread.java:662)

    Terracotta Project Issue Tracker | 4 years ago | Mitch Wright
    java.lang.IllegalStateException: Shutdown in progress
  5. 0

    Overview: From various bits of evidence I've observed, in 2.6.0 (at least) it looks like a shutdown hook is being registered automatically and that EhCache is shutting itself down independently of whatever else the application might be trying to do. From the documentation, this behaviour has changed from 2.4, where the hook could be enabled but was off by default: http://www.ehcache.org/documentation/2.4/user-guide/shutdown#the-shutdown-hook Iin my testing, setting net.sf.ehcache.enableShutdownHook=false had no (obvious) effect (in 2.6.0). To support environments where the application is using a hook to shut itself and its resources down gracefully (either directly or indirectly via a container), it seems that EhCache should provide a switch/option (such as it did in earlier releases) to disable automated cleanup. Then disabled, EhCache would on rely on the application to indicate (by calling the shutdown method on the CacheManagers) that is it through using the caches. Background: I noticed the following messages appearing in the log regarding EhCache resources being shutdown, regardless of whether the CacheManager.shutdown was being call explicitly or not: 20:17:54.894 [Thread-2] DEBUG o.t.modules.ehcache.LocalVMResources - Unregistering Cache with name: local-shadow-cache-for-TestCache-uuid-mwright-Precision-M4700/127.0.1.1-8b2e1497-a1a5-4004-91a2-d55a5ff753cc 20:17:54.894 [Thread-21] INFO o.t.m.e.s.s.EhcacheSMLocalStore - Ignoring getOffHeapSize as inner cache is not alive. 20:17:54.899 [Thread-21] INFO EhCacheTest - Cache statistics: Total [ 14496], In memory [ 0], evictions [0] 2013-02-06 20:17:55,789 INFO - Channel ChannelID=[19] closed. 20:17:55.894 [Out of band notifier - 0] INFO n.s.e.terracotta.TerracottaClient - Thread [Out of band notifier - 0] [cacheManager: 'EhCacheTest']: ClusterNode [id=ClientID[19]] went offline (currentNode=ClientID[19]) 20:17:55.895 [Out of band notifier - 1] INFO n.s.e.terracotta.TerracottaClient - Thread [Out of band notifier - 1] [cacheManager: 'EhCacheTest']: ClusterNode [id=ClientID[19]] left the cluster (currentNode=ClientID[19]) I discovered, quite accidentally, that indeed a shutdown hook was being registered by EhCache, when my test harness exited during start up, causing this stack trace to be generated: java.lang.IllegalStateException: Shutdown in progress at java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:39) at java.lang.Runtime.addShutdownHook(Runtime.java:192) at com.tc.util.CommonShutDownHook.addShutdownHook(CommonShutDownHook.java:49) at com.tc.object.DistributedObjectClient.setLoggerOnExit(DistributedObjectClient.java:1089) at com.tc.object.DistributedObjectClient.start(DistributedObjectClient.java:839) at com.tc.object.bytecode.ManagerImpl$2.execute(ManagerImpl.java:284) at com.tc.lang.StartupHelper.startUp(StartupHelper.java:39) at com.tc.object.bytecode.ManagerImpl.startClient(ManagerImpl.java:302) at com.tc.object.bytecode.ManagerImpl.init(ManagerImpl.java:212) at com.tc.object.bytecode.ManagerImpl.init(ManagerImpl.java:194) at com.tc.object.bytecode.hook.impl.DSOContextImpl.createStandaloneContext(DSOContextImpl.java:186) at com.terracotta.express.StandaloneL1Boot.call(StandaloneL1Boot.java:211) at com.terracotta.express.ClientImpl.<init>(ClientImpl.java:369) at com.terracotta.express.ClientFactoryImpl.newClient(ClientFactoryImpl.java:286) at com.terracotta.express.ClientFactoryImpl.createClient(ClientFactoryImpl.java:279) at com.terracotta.express.ClientFactoryImpl.createDedicatedRejoinClient(ClientFactoryImpl.java:170) at org.terracotta.express.ClientFactoryExtras.createDedicatedRejoinClient(ClientFactoryExtras.java:40) at net.sf.ehcache.terracotta.StandaloneTerracottaClusteredInstanceFactory.<init>(StandaloneTerracottaClusteredInstanceFactory.java:35) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at net.sf.ehcache.util.ClassLoaderUtil.createNewInstance(ClassLoaderUtil.java:92) at net.sf.ehcache.terracotta.TerracottaClusteredInstanceHelper.newClusteredInstanceFactory(TerracottaClusteredInstanceHelper.java:176) at net.sf.ehcache.terracotta.TerracottaClient.createNewClusteredInstanceFactory(TerracottaClient.java:186) at net.sf.ehcache.terracotta.TerracottaClient.access$1500(TerracottaClient.java:52) at net.sf.ehcache.terracotta.TerracottaClient$RejoinWorker.doRejoin(TerracottaClient.java:430) at net.sf.ehcache.terracotta.TerracottaClient$RejoinWorker.run(TerracottaClient.java:338) at java.lang.Thread.run(Thread.java:662)

    Terracotta Project Issue Tracker | 4 years ago | Mitch Wright
    java.lang.IllegalStateException: Shutdown in progress

  1. kjhdofjosvs 2 times, last 2 weeks ago
  2. eti22 1 times, last 1 month ago
  3. mauritius 1 times, last 2 months ago
  4. andyglick 5 times, last 2 months ago
  5. andyglick 3 times, last 2 months ago
3 more registered users
7 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalStateException

    Shutdown in progress

    at java.lang.ApplicationShutdownHooks.add()
  2. Java RT
    Runtime.addShutdownHook
    1. java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:39)
    2. java.lang.Runtime.addShutdownHook(Runtime.java:192)
    2 frames
  3. com.tc.util
    CommonShutDownHook.addShutdownHook
    1. com.tc.util.CommonShutDownHook.addShutdownHook(CommonShutDownHook.java:49)
    1 frame
  4. com.tc.object
    ManagerImpl$2.execute
    1. com.tc.object.DistributedObjectClient.setLoggerOnExit(DistributedObjectClient.java:1089)
    2. com.tc.object.DistributedObjectClient.start(DistributedObjectClient.java:839)
    3. com.tc.object.bytecode.ManagerImpl$2.execute(ManagerImpl.java:284)
    3 frames
  5. com.tc.lang
    StartupHelper.startUp
    1. com.tc.lang.StartupHelper.startUp(StartupHelper.java:39)
    1 frame
  6. com.tc.object
    DSOContextImpl.createStandaloneContext
    1. com.tc.object.bytecode.ManagerImpl.startClient(ManagerImpl.java:302)
    2. com.tc.object.bytecode.ManagerImpl.init(ManagerImpl.java:212)
    3. com.tc.object.bytecode.ManagerImpl.init(ManagerImpl.java:194)
    4. com.tc.object.bytecode.hook.impl.DSOContextImpl.createStandaloneContext(DSOContextImpl.java:186)
    4 frames
  7. com.terracotta.express
    ClientFactoryImpl.createDedicatedRejoinClient
    1. com.terracotta.express.StandaloneL1Boot.call(StandaloneL1Boot.java:211)
    2. com.terracotta.express.ClientImpl.<init>(ClientImpl.java:369)
    3. com.terracotta.express.ClientFactoryImpl.newClient(ClientFactoryImpl.java:286)
    4. com.terracotta.express.ClientFactoryImpl.createClient(ClientFactoryImpl.java:279)
    5. com.terracotta.express.ClientFactoryImpl.createDedicatedRejoinClient(ClientFactoryImpl.java:170)
    5 frames
  8. org.terracotta.express
    ClientFactoryExtras.createDedicatedRejoinClient
    1. org.terracotta.express.ClientFactoryExtras.createDedicatedRejoinClient(ClientFactoryExtras.java:40)
    1 frame
  9. Ehcache
    StandaloneTerracottaClusteredInstanceFactory.<init>
    1. net.sf.ehcache.terracotta.StandaloneTerracottaClusteredInstanceFactory.<init>(StandaloneTerracottaClusteredInstanceFactory.java:35)
    1 frame
  10. Java RT
    Constructor.newInstance
    1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    2. sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    4. java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    4 frames
  11. Ehcache
    TerracottaClient$RejoinWorker.run
    1. net.sf.ehcache.util.ClassLoaderUtil.createNewInstance(ClassLoaderUtil.java:92)
    2. net.sf.ehcache.terracotta.TerracottaClusteredInstanceHelper.newClusteredInstanceFactory(TerracottaClusteredInstanceHelper.java:176)
    3. net.sf.ehcache.terracotta.TerracottaClient.createNewClusteredInstanceFactory(TerracottaClient.java:186)
    4. net.sf.ehcache.terracotta.TerracottaClient.access$1500(TerracottaClient.java:52)
    5. net.sf.ehcache.terracotta.TerracottaClient$RejoinWorker.doRejoin(TerracottaClient.java:430)
    6. net.sf.ehcache.terracotta.TerracottaClient$RejoinWorker.run(TerracottaClient.java:338)
    6 frames
  12. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:662)
    1 frame