• Bug
  • Status: Closed
  • Resolution: Fixed
  • drb
  • Reporter: sourceforgetracker
  • September 21, 2009
  • 0
  • Watchers: 0
  • September 22, 2009
  • September 22, 2009


I have a somewhat strange setup with a home grown class loader, which in some circumstances may access a Cache instance. This class loader is set as the context class loader on multiple threads.

Consider this situation: T1 loads a class C1 and waits to access the cache. T1 has a lock on the class loader due to going through the synchronized ClassLoader.loadClass() method. T2 accesses the cache - hence locks the cache instance as get() is synchronized

  • and needs to load the requested entry from disk. During deserialization the DiskStore.loadElementFromDiskElement() method tries to deserialize the entry and uses the thread context class loader to load the class.

Result: T1 waits for T2’s lock on the cache object T2 waits for T1’s lock on the class loader

If I replace the call



Class.forName(clazz.getName(), false, classLoader);

I do not get the deadlock, provided the entry’s class has already been loaded.

I attach a patch for this small change. Sourceforge Ticket ID: 1445694 - Opened By: fmeschbe - 8 Mar 2006 14:46 UTC


Fiona OShea 2009-09-22

Re-opening so that I can properly close out these issues and have correct Resolution status in Jira