Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345652 - ClassLoader hangs - does not recover
Summary: ClassLoader hangs - does not recover
Status: RESOLVED NOT_ECLIPSE
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Launcher (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-12 16:00 EDT by Hendrik Renken CLA
Modified: 2011-05-31 09:16 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hendrik Renken CLA 2011-05-12 16:00:26 EDT
Build Identifier: 20110301-1815

I'm trying to run a .product. During the bundle activation process, the ClassLoader just hangs when tyring to load a class. After entering "close" on the console, the activation process recovers and starts the whole product without problems and then shuts down (as i requested).
Reproducable: Always.

Adding option "osgi.classloader.lock=classname" as suggested in Bug #344030 does not help. Happens on a fresh install of Mac OS X and with a fresh install of eclipse 3.6.2
Stacktrace of the thread where the ClassLoader hangs:

Daemon Thread [Start Level Event Dispatcher] (Suspended)	
	ClassLoader$NativeLibrary.load(String) line: not available [native method]	
	ClassLoader.loadLibrary0(Class, File) line: 1823	
	ClassLoader.loadLibrary(Class, String, boolean) line: 1720	
	Runtime.loadLibrary0(Class, String) line: 823	
	System.loadLibrary(String) line: 1045	
	LoadLibraryAction.run() line: 50	
	AccessController.doPrivileged(PrivilegedAction<T>) line: not available [native method]	
	Toolkit.loadLibraries() line: 1605	
	Toolkit.<clinit>() line: 1627	
	Color.<clinit>() line: 263	
	PinballDemo3D.createModel(IInnerScheduler) line: 61	
	Runtime.loadSimulation(IModelDescription) line: 76	
	Activator.start(BundleContext) line: 42	
	BundleContextImpl$1.run() line: 783	
	AccessController.doPrivileged(PrivilegedExceptionAction<T>) line: not available [native method]	
	BundleContextImpl.startActivator(BundleActivator) line: 774	
	BundleContextImpl.start() line: 755	
	BundleHost.startWorker(int) line: 370	
	BundleHost(AbstractBundle).resume() line: 374	
	Framework.resumeBundle(AbstractBundle) line: 1067	
	StartLevelManager.resumeBundles(AbstractBundle[], boolean, int) line: 561	
	StartLevelManager.resumeBundles(AbstractBundle[], int) line: 546	
	StartLevelManager.incFWSL(int, AbstractBundle[]) line: 459	
	StartLevelManager.doSetStartLevel(int) line: 243	
	StartLevelManager.dispatchEvent(Object, Object, int, Object) line: 440	
	EventManager.dispatchEvent(Set, EventDispatcher, int, Object) line: 227	
	EventManager$EventThread.run() line: 337	


Reproducible: Always
Comment 1 Andrew Niefer CLA 2011-05-25 15:14:32 EDT
(In reply to comment #0)
>     Toolkit.loadLibraries() line: 1605    
>     Toolkit.<clinit>() line: 1627    
>     Color.<clinit>() line: 263    

Is this AWT?

Try starting the eclipse launcher with the "--launcher.secondThread" argument.  SWT won't work with this argument, but AWT requires the main thread to be spinning the event loop.
Comment 2 Hendrik Renken CLA 2011-05-31 05:53:17 EDT
I think it has nothing to do with AWT. I'm not even sure i'm starting that.
"--launcher.secondThread" does not help. 

This is the thread-list as it appears in the debug-window:

org.eclipse.equinox.launcher.Main at localhost:53962	
	Thread [main] (Running)	
	Daemon Thread [Thread-1] (Running)	
	Daemon Thread [Poller SunPKCS11-Darwin] (Suspended)	
	Thread [OSGi Console] (Running)	
	Daemon Thread [State Saver] (Running)	
	Daemon Thread [Start Level Event Dispatcher] (Running)	
	Daemon Thread [Framework Event Dispatcher] (Running)	
	Thread [Worker-JM] (Running)	
	Daemon Thread [[Timer] - Main Queue Handler] (Running)	
	Daemon Thread [[ThreadPool Manager] - Idle Thread] (Running)	
	Thread [Worker-0] (Running)	
	Daemon Thread [Thread-5] (Running)	
	Daemon Thread [Thread-6] (Running)	
	Thread [Worker-1] (Running)	

It does only happen under Mac OS. Using windows or linux, the very same code does not show these problems.

When setting all start-levels of all plugins to default the Classloader still hangs.
Also, it then shows these errors:
!MESSAGE Getting a lock required more than 10000 ms. There might be a synchronization problem in this callstack or just the build/dispose process of some components took too long! 
!STACK 0
java.lang.Exception: Debug stacktrace
	at org.eclipse.equinox.internal.ds.InstanceProcess.getLock(InstanceProcess.java:119)
	at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:158)
	at org.eclipse.equinox.internal.ds.Resolver.buildNewlySatisfied(Resolver.java:441)
	at org.eclipse.equinox.internal.ds.Resolver.enableComponents(Resolver.java:213)
	at org.eclipse.equinox.internal.ds.SCRManager.performWork(SCRManager.java:800)
	at org.eclipse.equinox.internal.ds.SCRManager$QueuedJob.dispatch(SCRManager.java:767)
	at org.eclipse.equinox.internal.ds.WorkThread.run(WorkThread.java:89)
	at org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run(Executor.java:70)
Comment 3 Hendrik Renken CLA 2011-05-31 09:14:11 EDT
Apparently it was java.awt. We were using the AWT-Color class to convert Color-Objects into floating point values.
After removing these lines, the project works like a charm.

Issue found. But maybe the classloader should throw an exception or (at least in Debug-Mode) issue a warning into the logs to help find this particular problem.
Thanks for the help :)
Comment 4 Thomas Watson CLA 2011-05-31 09:16:06 EDT
(In reply to comment #3)
> Apparently it was java.awt. We were using the AWT-Color class to convert
> Color-Objects into floating point values.
> After removing these lines, the project works like a charm.
> 
> Issue found. But maybe the classloader should throw an exception or (at least
> in Debug-Mode) issue a warning into the logs to help find this particular
> problem.
> Thanks for the help :)

Unfortunately the Equinox class loader is not involved here and cannot really do much to help, sorry.