• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Fixed
  • hsingh
  • Reporter: asingh
  • May 15, 2010
  • 0
  • Watchers: 1
  • January 17, 2013
  • June 17, 2010


When running unclustered ehcache and overflowToDisk=true, the app vm refuses to exit. Seems like threads for executing disk writer tasks are not started in daemon mode. In DiskStorageFactory constructor: diskWriter = new ScheduledThreadPoolExecutor(1, new ThreadFactory() { public Thread newThread(Runnable r) { return new Thread(r, file.getName()); } });


Chris Dennis 2010-05-17

The original does seem to declare the disk writing thread as a daemon. In the case of a non-persistent cache I can see how this could be a good idea. In the case of a persistent cache however you really want the thread to wait until it terminates normally otherwise the persistent cache will almost certainly be corrupt.

Abhishek Singh 2010-05-18

I don’t remember if i was using diskPersistent true or false, was running an app with auto-generated config. The app refused to exit, and making overflowToDisk=false fixed it. I don’t think I was doing any op on the cache, even if it was persistent, so probably not sure when/how/who created the thread. Will try to post a reproducable sample here.

Steve Harris 2010-05-18

It seems odd to rely on the threads not being daemon to solve that flush problem

Chris Dennis 2010-06-17

Non-persistent disk stores now have daemon writer threads.

Himadri Singh 2010-07-06

Not able to reproduce in ehcache-core 2.2.0