Ticket #257 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

ClassCircularityError during OTDT start-up

Reported by: stephan Owned by: stephan
Priority: major Milestone: OTDT_1.3.0_M3
Component: otequinox Version: 1.3.0M2
Keywords: Cc:

Description

Team class JavaEditorAdaptor can cause a ClassCircularityError during start-up of the OTDT:

Thread [main] (Suspended (exception ClassCircularityError))	
	Class<T>.getDeclaredConstructors0(boolean) line: not available [native method]	
	Class<T>.privateGetDeclaredConstructors(boolean) line: 2389	
	Class<T>.getConstructor0(Class[], int) line: 2699	
	Class<T>.newInstance0() line: 326	
	Class<T>.newInstance() line: 308	
	MasterTeamLoader$TeamClassRecord.newInstance() line: 131	
	MasterTeamLoader.instantiateLoadedTeams(Bundle, String, AspectPermissionManager) line: 254	
	TransformerPlugin.internalInstantiateTeams(Bundle, String) line: 503	
	TransformerPlugin.instantiateTeams(Bundle, String) line: 448	
	BaseBundleRole.endActivation(ITeamLoader) line: 150	
	BaseBundleRole.endActivation(BundleRegistry, Bundle, SafeAspectRegistry, ITeamLoader) line: 122	
	TransformerHook.watchBundle(Bundle, int) line: 538	
	BaseAdaptor$2.watchBundle(Bundle, int) line: 363	
	BundleHost.startWorker(int) line: 383	
	BundleHost(AbstractBundle).start(int) line: 280	
	SecureAction.start(Bundle, int) line: 408	
	EclipseLazyStarter.postFindLocalClass(String, Class, ClasspathManager) line: 111	
	ClasspathManager.findLocalClass(String) line: 447	
	DefaultClassLoader.findLocalClass(String) line: 194	
	BundleLoader.findLocalClass(String) line: 376	
	SingleSourcePackage.loadClass(String) line: 33	
	BundleLoader.findClassInternal(String, boolean, ClassLoader) line: 449	
	BundleLoader.findClass(String, boolean) line: 405	
	BundleLoader.findClass(String) line: 393	
	DefaultClassLoader.loadClass(String, boolean) line: 88	
	DefaultClassLoader(ClassLoader).loadClass(String) line: 252	
	DefaultClassLoader(ClassLoader).loadClassInternal(String) line: 320	
	Class<T>.getDeclaredConstructors0(boolean) line: not available [native method]	
	Class<T>.privateGetDeclaredConstructors(boolean) line: 2389	
	Class<T>.getConstructor0(Class[], int) line: 2699	
	Class<T>.newInstance0() line: 326	
	Class<T>.newInstance() line: 308	
	MasterTeamLoader$TeamClassRecord.newInstance() line: 131	
	MasterTeamLoader.instantiateLoadedTeams(Bundle, String, AspectPermissionManager) line: 254	
	TransformerPlugin.internalInstantiateTeams(Bundle, String) line: 503	
	TransformerPlugin.instantiateTeams(Bundle, String) line: 448	
	BaseBundleRole.endActivation(ITeamLoader) line: 150	
	BaseBundleRole.endActivation(BundleRegistry, Bundle, SafeAspectRegistry, ITeamLoader) line: 122	
	TransformerHook.watchBundle(Bundle, int) line: 538	
	BaseAdaptor$2.watchBundle(Bundle, int) line: 363	
	BundleHost.startWorker(int) line: 383	
	BundleHost(AbstractBundle).start(int) line: 280	
	SecureAction.start(Bundle, int) line: 408	
	EclipseLazyStarter.postFindLocalClass(String, Class, ClasspathManager) line: 111	
	ClasspathManager.findLocalClass(String) line: 447	
	DefaultClassLoader.findLocalClass(String) line: 194	
	BundleLoader.findLocalClass(String) line: 376	
	BundleLoader.findClassInternal(String, boolean, ClassLoader) line: 452	
	BundleLoader.findClass(String, boolean) line: 405	
	BundleLoader.findClass(String) line: 393	
	DefaultClassLoader.loadClass(String, boolean) line: 88	
	DefaultClassLoader(ClassLoader).loadClass(String) line: 252	
	BundleLoader.loadClass(String) line: 321	
	BundleHost.loadClass(String, boolean) line: 231	
	BundleHost(AbstractBundle).loadClass(String) line: 1193	
	EquinoxRegistryStrategy(RegistryStrategyOSGI).createExecutableExtension(RegistryContributor, String, String) line: 160	
	ExtensionRegistry.createExecutableExtension(RegistryContributor, String, String) line: 874	
	ConfigurationElement.createExecutableExtension(String) line: 243	
	ConfigurationElementHandle.createExecutableExtension(String) line: 51	
	WorkbenchPlugin$1.run() line: 267	
	BusyIndicator.showWhile(Display, Runnable) line: 70	
	WorkbenchPlugin.createExtension(IConfigurationElement, String) line: 263	
	EditorDescriptor.createEditor() line: 235	
	EditorManager.createPart(EditorDescriptor) line: 845	
	EditorReference.createPartHelper() line: 606	
	EditorReference.createPart() line: 462	
	EditorReference(WorkbenchPartReference).getPart(boolean) line: 595	
	EditorAreaHelper.setVisibleEditor(IEditorReference, boolean) line: 271	
	EditorManager.setVisibleEditor(IEditorReference, boolean) line: 1417	
	EditorManager$5.runWithException() line: 942	
	EditorManager$5(StartupThreading$StartupRunnable).run() line: 31	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 134	
	Display.runAsyncMessages(boolean) line: 3468	
	Display.readAndDispatch() line: 3115	
	IDEWorkbenchAdvisor(WorkbenchAdvisor).openWindows() line: 803	
	Workbench$28.runWithException() line: 1384	
	Workbench$28(StartupThreading$StartupRunnable).run() line: 31	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 134	
	Display.runAsyncMessages(boolean) line: 3468	
	Display.readAndDispatch() line: 3115	
	Workbench.runUI() line: 2316	
	Workbench.access$4(Workbench) line: 2221	
	Workbench$5.run() line: 500	
	Realm.runWithDefault(Realm, Runnable) line: 332	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 493	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 113	
	EclipseAppHandle.run(Object) line: 194	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 368	
	EclipseStarter.run(String[], Runnable) line: 179	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 597	
	Main.invokeFramework(String[], URL[]) line: 559	
	Main.basicRun(String[]) line: 514	
	Main.run(String[]) line: 1311	
	Main.main(String[]) line: 1287	

Inspecting this stack trace in the debugger shows:

  • The EditorManager tries to fire-up a org.eclipse.jdt.ui.CompilationUnitEditor
  • createExecutableExtension thus goes about loading class org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor
  • postFindLocalClass triggers bundle org.eclipse.ui.editors to be activated -- this is because the class resides in org.eclipse.jdt.ui which depends on org.eclipse.ui.editors
  • when TransformerHook.watchBundle observes that org.eclipse.ui.editors has finished activation it triggers instantiation of pending teams
  • the corresponding MasterTeamLoader has class org.objectteams.otdt.internal.ui.javaeditor.JavaEditorAdaptor pending, because an aspectBinding claims that this team adapts org.eclipse.ui.editors.
  • reflective access to the team's constructor causes class CompilationUnitEditor to be loaded (its the base class of one of its roles, perhaps the signature of some generated method causes this loading).
  • interestingly no class loader detects the re-entrent attempt to load this class at this point
  • postLocalFindClass the org.eclipse.jdt.ui is now activated
  • TransformerHook.watchBundle observes end activation for org.eclispe.jdt.ui and triggers pending team instantiation.
  • a different MasterTeamLoader, using a different TeamClassRecord referring to the same Class<...JavaEditorAdaptor> tries instantiating this team
  • at this point reflective access to the constructor, when trying to load class ..CompilationUnitEditor detects the cycle.

Attachments

class-circularity-testcase.zip Download (16.2 KB) - added by stephan 3 years ago.
set of sample plugins reproducing the issue (by mosconi)

Change History

Changed 3 years ago by stephan

set of sample plugins reproducing the issue (by mosconi)

Changed 3 years ago by stephan

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to OTDT_1.3.0_M3

This proved to be the same issue as it had been identified by mosconi (see attachment:class-circularity-testcase.zip Download).

Fixed in r21612 and verified using the testcase:

  • record the fact that a team class is being instantiated before calling newInstance, which might cause re-entrant actions.
Note: See TracTickets for help on using tickets.