Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] java.lang.RuntimeException: Attempt to access stopped agent: org.eclipse.equinox.internal.p2.core.ProvisioningAgent@65fa65fa


Thanks, John.  Yes, I too noticed that SimpleProfileRegistry.stop() joined the save job after I sent the email and so it baffled me for awhile how this could be happening.  However, I think I figured out what is going wrong and it's a bug in my code.  The code was mistakenly creating two different IProvisioningAgent instances (from two unrelated areas of code) using the same location URI.  This is a bad thing for lots of reasons, but in this particular case, it messes up ProfilePreferences.getAgent() which assumes a 1-to-1 mapping of location to agent.  I'm pretty sure this is the problem, but if not I'll enter a bugzilla.  I've coded up a fix and I'll start up another build to confirm it (the error only seems to happen when running junits on the build machine .. not on my machine .. probably a timing issue).


From: John Arthorne <arthorne.eclipse@xxxxxxxxx>
To: P2 developer discussions <p2-dev@xxxxxxxxxxx>
Date: 03/18/2010 02:24 PM
Subject: Re: [p2-dev] java.lang.RuntimeException: Attempt to access stopped         agent: org.eclipse.equinox.internal.p2.core.ProvisioningAgent@65fa65fa
Sent by: p2-dev-bounces@xxxxxxxxxxx





Can you enter a bug for this? What's supposed to happen is that when the agent is stopped, it tells all registered services to stop. In the method SimpleProfileRegistry#stop it joins any existing preference save job. This should ensure there is no preference save job running after the agent has been stopped. Maybe in your case you never access the IProfileRegistry service so that service is never created in the agent? Or, there could be a timing problem I'm missing. In any case, please enter a bug and CC me and I can take a look.

John



On Thu, Mar 18, 2010 at 12:31 PM, Thomas M Houser <tmhouser@xxxxxxxxxx> wrote:

I am using the IProvisioningAgentProvider.createAgent() and IProvisioningAgent.stop() APIs and I'm getting this exception:


java.lang.RuntimeException: Attempt to access stopped agent: org.eclipse.equinox.internal.p2.core.ProvisioningAgent@65fa65fa

        at org.eclipse.equinox.internal.p2.core.ProvisioningAgent.checkRunning(ProvisioningAgent.java:79)

        at org.eclipse.equinox.internal.p2.core.ProvisioningAgent.getService(ProvisioningAgent.java:45)

        at org.eclipse.equinox.internal.p2.engine.ProfilePreferences.doSave(ProfilePreferences.java:112)

        at org.eclipse.equinox.internal.p2.engine.ProfilePreferences$SaveJob.run(ProfilePreferences.java:49)

        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


The ProfilePreferences.save() method schedules a job with the IProvisioningAgent instance that I created and am stopping:


Thread [main] (Suspended (breakpoint at line 40 in ProfilePreferences$SaveJob))        

        ProfilePreferences$SaveJob.<init>(ProfilePreferences, IProvisioningAgent) line: 40        

        ProfilePreferences.save() line: 275        

        ProfilePreferences(EclipsePreferences).flush() line: 352        

        ProfilePreferences(EclipsePreferences).flush() line: 340        

        MetadataRepositoryManager(AbstractRepositoryManager<T>).saveToPreferences() line: 979        

        MetadataRepositoryManager(AbstractRepositoryManager<T>).remember(RepositoryInfo<T>, boolean) line: 839        

        MetadataRepositoryManager(AbstractRepositoryManager<T>).addRepository(URI, boolean, boolean) line: 167        

        MetadataRepositoryManager(AbstractRepositoryManager<T>).loadRepository(URI, IProgressMonitor, String, int) line: 639        

        MetadataRepositoryManager(AbstractRepositoryManager<T>).doCreateRepository(URI, String, String, Map<String,String>) line: 271        

        MetadataRepositoryManager.createRepository(URI, String, String, Map<String,String>) line: 41        


How can I safely stop an IProvisioningAgent  instance when there is a scheduled job that will access it?  Is this a bug?

_______________________________________________
p2-dev mailing list

p2-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/p2-dev

_______________________________________________
p2-dev mailing list
p2-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/p2-dev



Back to the top