Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 342234

Summary: [Query 2 Index View] BundleException during Shutdown of IDE if Index View is Opened.
Product: [Modeling] EMF Reporter: Animesh Kumar <animesh143>
Component: Query2Assignee: Project Inbox <emf.query2-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: animesh143, ashw.kumar
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Releases the Locked Resource Descriptors wayne.beaton: iplog+

Description Animesh Kumar CLA 2011-04-08 01:14:10 EDT
Build Identifier: 

Whenever I shut down the IDE, after opening Index View, I get a BundleException which is caused due to Locked Paging Strategy Pages. It Happens only if I have opened Index View before shutting down the IDE. This problem persists even if, Index View was opened and then closed. But, if the Index View is not at all opened in the IDE lifecycle. The stacktrace is as follows:-
org.osgi.framework.BundleException: Exception in org.eclipse.emf.query.index.Activator.stop() of bundle org.eclipse.emf.query2.index.
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.stop(BundleContextImpl.java:863)
	at org.eclipse.osgi.framework.internal.core.BundleHost.stopWorker(BundleHost.java:501)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.suspend(AbstractBundle.java:550)
	at org.eclipse.osgi.framework.internal.core.Framework.suspendBundle(Framework.java:1097)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.decFWSL(StartLevelManager.java:597)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:257)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.shutdown(StartLevelManager.java:215)
	at org.eclipse.osgi.framework.internal.core.InternalSystemBundle.suspend(InternalSystemBundle.java:266)
	at org.eclipse.osgi.framework.internal.core.Framework.shutdown(Framework.java:690)
	at org.eclipse.osgi.framework.internal.core.Framework.close(Framework.java:588)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.shutdown(EclipseStarter.java:415)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:198)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: java.lang.IllegalStateException: Paging strategy has locked pages
	at org.eclipse.emf.query.index.internal.impl.PagingStrategyImpl.flush(PagingStrategyImpl.java:334)
	at org.eclipse.emf.query.index.internal.impl.PagingResourceDescriptorMap.flush(PagingResourceDescriptorMap.java:105)
	at org.eclipse.emf.query.index.internal.impl.PageableIndexImpl.save(PageableIndexImpl.java:125)
	at org.eclipse.emf.query.index.IndexFactory.dumpIndexes(IndexFactory.java:97)
	at org.eclipse.emf.query.index.Activator.stop(Activator.java:51)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:843)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.stop(BundleContextImpl.java:836)
	... 19 more
Root exception:
java.lang.IllegalStateException: Paging strategy has locked pages
	at org.eclipse.emf.query.index.internal.impl.PagingStrategyImpl.flush(PagingStrategyImpl.java:334)
	at org.eclipse.emf.query.index.internal.impl.PagingResourceDescriptorMap.flush(PagingResourceDescriptorMap.java:105)
	at org.eclipse.emf.query.index.internal.impl.PageableIndexImpl.save(PageableIndexImpl.java:125)
	at org.eclipse.emf.query.index.IndexFactory.dumpIndexes(IndexFactory.java:97)
	at org.eclipse.emf.query.index.Activator.stop(Activator.java:51)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:843)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.stop(BundleContextImpl.java:836)
	at org.eclipse.osgi.framework.internal.core.BundleHost.stopWorker(BundleHost.java:501)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.suspend(AbstractBundle.java:550)
	at org.eclipse.osgi.framework.internal.core.Framework.suspendBundle(Framework.java:1097)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.decFWSL(StartLevelManager.java:597)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:257)
	at org.eclipse.osgi.framework.internal.core.StartLevelManager.shutdown(StartLevelManager.java:215)
	at org.eclipse.osgi.framework.internal.core.InternalSystemBundle.suspend(InternalSystemBundle.java:266)
	at org.eclipse.osgi.framework.internal.core.Framework.shutdown(Framework.java:690)
	at org.eclipse.osgi.framework.internal.core.Framework.close(Framework.java:588)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.shutdown(EclipseStarter.java:415)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:198)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)


Reproducible: Always

Steps to Reproduce:
1. Open Index View.
2. Expand Resource Index Node.
3. Expand any of the the Resource Descriptor Node.
4. Close the IDE.
Comment 1 Animesh Kumar CLA 2011-04-08 01:20:55 EDT
Created attachment 192794 [details]
Releases the Locked Resource Descriptors

This Exception was occuring because in Index View, to retrieve the EObject Tables, incoming Link Tables, and Outgoing Tables, an acquire() was called on the ResourceDescriptors, but these descriptors were not released after retrieving the local tables.
An addition in the code to release() the ResourceDescriptor solves the problem.
Comment 2 Ashwani Kr Sharma CLA 2011-04-13 00:59:38 EDT
patch submitted