The classlib tests hang sporadically, usually in JNDI module when running all classlib unit tests (single runs of JNDI alone always ok).
Investigation shows that there are deadlocks happening between main thread (MT) and finalizer thread (FT):
1) MT performs classloading, it grabs ClassLoader::_lock;
2) GC happens, FinalizerThread.startFinalization() is called, FT activates;
3) FT invokes some finalize() method, compilation starts and grabs g_compileLock;
4) FT waits for ClassLoader::_lock to allocate code_chunk_info;
5) MT proceeds to compilation of FinalizerThread.spawnBalanceThreads() and waits for g_compileLock;