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

Bug 316361

Summary: IllegalStateException from preference injection when a bundle is stopped
Product: z_Archived Reporter: Brian de Alwis <bsd>
Component: E4Assignee: Project Inbox <e4.runtime-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ob1.eclipse
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
Patch none

Description Brian de Alwis CLA 2010-06-09 15:21:55 EDT
BuildId: HEAD as of 2010/06/08 AM

I've been porting the e4rover code to the latest.  Shutting down the client causes an IllegalStateException:

java.lang.IllegalStateException: BundleContext is no longer valid
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.checkValid(BundleContextImpl.java:1003)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.getServiceReference(BundleContextImpl.java:602)
	at org.eclipse.e4.core.internal.contexts.osgi.OSGiContextStrategy.containsKey(OSGiContextStrategy.java:157)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.containsKey(EclipseContext.java:230)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.containsKey(EclipseContext.java:218)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.containsKey(EclipseContext.java:227)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.containsKey(EclipseContext.java:218)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.containsKey(EclipseContext.java:227)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.containsKey(EclipseContext.java:218)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.containsKey(EclipseContext.java:227)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.containsKey(EclipseContext.java:218)
	at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier.get(ContextObjectSupplier.java:149)
	at org.eclipse.e4.core.internal.di.InjectorImpl.resolveArgs(InjectorImpl.java:328)
	at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:284)
	at org.eclipse.e4.core.internal.di.InjectorImpl.resolveArguments(InjectorImpl.java:257)
	at org.eclipse.e4.core.internal.di.Requestor.resolveArguments(Requestor.java:96)
	at org.eclipse.e4.ui.internal.di.UIEventObjectSupplier$UIEventHandler.handleEvent(UIEventObjectSupplier.java:36)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:188)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:198)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:139)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
	at org.eclipsecon.e4rover.core.ContestPlatform.fireGameUpdated(ContestPlatform.java:256)
	at org.eclipsecon.e4rover.core.ContestPlatform.access$9(ContestPlatform.java:254)
	at org.eclipsecon.e4rover.core.ContestPlatform$1.run(ContestPlatform.java:175)
Comment 1 Oleg Besedin CLA 2010-06-11 10:07:09 EDT
Created attachment 171724 [details]
Patch

The patch should fix "a" problem when stopped DI bundle continues to receive updates for preferences. 

However, from the call stack it is not aparent what is the actual problem and if it is related to preferences at all.
Comment 2 Oleg Besedin CLA 2010-06-11 10:09:04 EDT
Patch applied to CVS Head.

Brian, I don't know if this is going to fix the problem you seeing or not - from that call stack it is rather hard to figure out what went wrong. Is the code you are working on available somewhere?
Comment 3 Brian de Alwis CLA 2010-06-12 04:09:36 EDT
Thanks Oleg.  I'll give the change a whirl when I have a moment.  The codebase is at:

    http://github.com/briandealwis/e4rover
Comment 4 Oleg Besedin CLA 2010-06-16 09:53:19 EDT
(In reply to comment #3)
> Thanks Oleg.  I'll give the change a whirl when I have a moment.  The codebase
> is at:
>     http://github.com/briandealwis/e4rover

I don't see exceptions when running this code so I'll assume it is fixed. If the problem shows up again, please re-open this bug and, if possible, provide steps to reproduce.