Community
Participate
Working Groups
My plugin is executing the following code to ensure that RSE is loaded correctly: // Force RSE plugin to load if (!RSEUIPlugin.isTheSystemRegistryActive()) { return false; } sysReg = RSECorePlugin.getDefault().getSystemRegistry(); if (sysReg == null) { return false; } while (!RSECorePlugin.getThePersistenceManager().isRestoreComplete()) { System.out.println("waiting for restore..."); try { Thread.sleep(500); } catch (InterruptedException e) { } } At some point during the loading of the RSE plugins, I get the following null pointer exceptions. I am only seeing these intermittently, about 50% of the time. I'm not changing the profile between launches. java.lang.NullPointerException at org.eclipse.rse.internal.persistence.dom.RSEDOMImporter.restoreFilterPool(RSEDOMImporter.java:376) at org.eclipse.rse.internal.persistence.dom.RSEDOMImporter.restoreProfile(RSEDOMImporter.java:90) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.load(RSEPersistenceManager.java:390) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.loadProfiles(RSEPersistenceManager.java:370) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.restoreProfiles(RSEPersistenceManager.java:231) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.restoreProfiles(RSEPersistenceManager.java:217) at org.eclipse.rse.internal.core.model.SystemProfileManager.getDefault(SystemProfileManager.java:55) at org.eclipse.rse.core.model.SystemStartHere.getSystemProfileManager(SystemStartHere.java:180) at org.eclipse.rse.ui.RSEUIPlugin$InitRSEJob.run(RSEUIPlugin.java:95) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) java.lang.NullPointerException at org.eclipse.rse.internal.persistence.PropertyFileProvider.getSaveJob(PropertyFileProvider.java:151) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.save(RSEPersistenceManager.java:420) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.commitProfile(RSEPersistenceManager.java:137) at org.eclipse.rse.internal.core.model.SystemProfile.commit(SystemProfile.java:216) at org.eclipse.rse.internal.core.model.SystemHostPool.commit(SystemHostPool.java:612) at org.eclipse.rse.internal.core.model.SystemHostPool.commit(SystemHostPool.java:621) at org.eclipse.rse.internal.core.model.SystemHostPool.updateHost(SystemHostPool.java:254) at org.eclipse.rse.internal.core.model.SystemHostPool.createHost(SystemHostPool.java:208) at org.eclipse.rse.ui.internal.model.SystemRegistry.createHost(SystemRegistry.java:1652) at org.eclipse.rse.ui.internal.model.SystemRegistry.createHost(SystemRegistry.java:1601) at org.eclipse.rse.ui.internal.model.SystemRegistry.createHost(SystemRegistry.java:1922) at org.eclipse.rse.ui.internal.model.SystemRegistry.createHost(SystemRegistry.java:1893) at org.eclipse.rse.internal.core.model.SystemProfile.createHost(SystemProfile.java:89) at org.eclipse.rse.internal.persistence.dom.RSEDOMImporter.restoreHost(RSEDOMImporter.java:125) at org.eclipse.rse.internal.persistence.dom.RSEDOMImporter.restoreProfile(RSEDOMImporter.java:88) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.load(RSEPersistenceManager.java:390) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.loadProfiles(RSEPersistenceManager.java:370) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.restoreProfiles(RSEPersistenceManager.java:231) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.restoreProfiles(RSEPersistenceManager.java:217) at org.eclipse.rse.internal.core.model.SystemProfileManager.getDefault(SystemProfileManager.java:55) at org.eclipse.rse.core.model.SystemStartHere.getSystemProfileManager(SystemStartHere.java:180) at org.eclipse.rse.ui.RSEUIPlugin$InitRSEJob.run(RSEUIPlugin.java:95) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) java.lang.NullPointerException at org.eclipse.rse.ui.internal.model.SystemRegistry.getServiceSubSystems(SystemRegistry.java:1104) at org.eclipse.rse.internal.persistence.dom.RSEDOMImporter.restoreSubSystem(RSEDOMImporter.java:231) at org.eclipse.rse.internal.persistence.dom.RSEDOMImporter.restoreConnectorService(RSEDOMImporter.java:169) at org.eclipse.rse.internal.persistence.dom.RSEDOMImporter.restoreHost(RSEDOMImporter.java:138) at org.eclipse.rse.internal.persistence.dom.RSEDOMImporter.restoreProfile(RSEDOMImporter.java:88) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.load(RSEPersistenceManager.java:390) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.loadProfiles(RSEPersistenceManager.java:370) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.restoreProfiles(RSEPersistenceManager.java:231) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.restoreProfiles(RSEPersistenceManager.java:217) at org.eclipse.rse.internal.core.model.SystemProfileManager.getDefault(SystemProfileManager.java:55) at org.eclipse.rse.core.model.SystemStartHere.getSystemProfileManager(SystemStartHere.java:180) at org.eclipse.rse.ui.RSEUIPlugin$InitRSEJob.run(RSEUIPlugin.java:95) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Created attachment 72695 [details] connection profile
Created attachment 72699 [details] more profiles
This doesn't appear to be a profile corruption problem. I've tried removing all the profiles and recreating new ones and I'm still getting this problem intermittently. It looks like 'anchor' is null in org.eclipse.rse.internal.persistence.PropertyFileProvider.getSaveJob(). Since anchor is only set when getAnchor() is called, I'm wondering if this is because I'm not doing anything with the UI before the profiles are being restored? Maybe this is some kind of UI dependency on core? In any case, RSE is not useable for providing remote services for PTP with this bug present.
Greg I'd love to help you but it's hard without more information. Could you try replacing the variable "anchor" in PropertyFileProvider line 151 by a getAnchor() call? This should fix the issue reported by you.
A traceback (log entry) from your NPE might help understanding why getAnchor() has not been called by the persistence framework before.
Here are the tracebacks. I'll try changing to getAnchor() next and see what that does. Traceback from error 'Error creating default pool': java.lang.NullPointerException at org.eclipse.rse.internal.persistence.PropertyFileProvider.getSaveJob(PropertyFileProvider.java:151) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.save(RSEPersistenceManager.java:423) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.commitProfile(RSEPersistenceManager.java:138) at org.eclipse.rse.internal.core.model.SystemProfile.commit(SystemProfile.java:216) at org.eclipse.rse.internal.core.filters.SystemFilterPool.commit(SystemFilterPool.java:1246) at org.eclipse.rse.internal.core.filters.SystemFilterPoolManager.commit(SystemFilterPoolManager.java:1645) at org.eclipse.rse.internal.core.filters.SystemFilterPoolManager.createSystemFilterPool(SystemFilterPoolManager.java:479) at org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystemConfiguration.createDefaultFilterPool(RemoteFileSubSystemConfiguration.java:334) at org.eclipse.rse.core.subsystems.SubSystemConfiguration.getFilterPoolManager(SubSystemConfiguration.java:1612) at org.eclipse.rse.core.subsystems.SubSystemConfiguration.getAllSystemFilterPoolManagers(SubSystemConfiguration.java:2601) at org.eclipse.rse.internal.core.subsystems.SubSystemConfigurationProxy.restore(SubSystemConfigurationProxy.java:268) at org.eclipse.rse.internal.core.subsystems.SubSystemConfigurationProxy.getSubSystemConfiguration(SubSystemConfigurationProxy.java:248) at org.eclipse.rse.ui.internal.model.SystemRegistry.getSubSystemConfiguration(SystemRegistry.java:304) at org.eclipse.rse.internal.persistence.dom.RSEDOMImporter.getSubSystemConfiguration(RSEDOMImporter.java:491) at org.eclipse.rse.internal.persistence.dom.RSEDOMImporter.restoreFilterPool(RSEDOMImporter.java:362) at org.eclipse.rse.internal.persistence.dom.RSEDOMImporter.restoreProfile(RSEDOMImporter.java:90) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.load(RSEPersistenceManager.java:393) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.loadProfiles(RSEPersistenceManager.java:373) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.restoreProfiles(RSEPersistenceManager.java:232) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.restoreProfiles(RSEPersistenceManager.java:218) at org.eclipse.rse.internal.core.model.SystemProfileManager.getDefault(SystemProfileManager.java:55) at org.eclipse.rse.core.model.SystemStartHere.getSystemProfileManager(SystemStartHere.java:180) at org.eclipse.rse.ui.RSEUIPlugin$InitRSEJob.run(RSEUIPlugin.java:98) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Traceback from error 'Exception in createConnection for 127.0.0.1': java.lang.NullPointerException at org.eclipse.rse.internal.persistence.PropertyFileProvider.getSaveJob(PropertyFileProvider.java:151) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.save(RSEPersistenceManager.java:423) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.commitProfile(RSEPersistenceManager.java:138) at org.eclipse.rse.internal.core.model.SystemProfile.commit(SystemProfile.java:216) at org.eclipse.rse.internal.core.model.SystemHostPool.commit(SystemHostPool.java:612) at org.eclipse.rse.internal.core.model.SystemHostPool.commit(SystemHostPool.java:621) at org.eclipse.rse.internal.core.model.SystemHostPool.updateHost(SystemHostPool.java:254) at org.eclipse.rse.internal.core.model.SystemHostPool.createHost(SystemHostPool.java:208) at org.eclipse.rse.ui.internal.model.SystemRegistry.createHost(SystemRegistry.java:1770) at org.eclipse.rse.ui.internal.model.SystemRegistry.createHost(SystemRegistry.java:1719) at org.eclipse.rse.ui.internal.model.SystemRegistry.createHost(SystemRegistry.java:2040) at org.eclipse.rse.ui.internal.model.SystemRegistry.createHost(SystemRegistry.java:2011) at org.eclipse.rse.internal.core.model.SystemProfile.createHost(SystemProfile.java:89) at org.eclipse.rse.internal.persistence.dom.RSEDOMImporter.restoreHost(RSEDOMImporter.java:125) at org.eclipse.rse.internal.persistence.dom.RSEDOMImporter.restoreProfile(RSEDOMImporter.java:88) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.load(RSEPersistenceManager.java:393) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.loadProfiles(RSEPersistenceManager.java:373) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.restoreProfiles(RSEPersistenceManager.java:232) at org.eclipse.rse.internal.persistence.RSEPersistenceManager.restoreProfiles(RSEPersistenceManager.java:218) at org.eclipse.rse.internal.core.model.SystemProfileManager.getDefault(SystemProfileManager.java:55) at org.eclipse.rse.core.model.SystemStartHere.getSystemProfileManager(SystemStartHere.java:180) at org.eclipse.rse.ui.RSEUIPlugin$InitRSEJob.run(RSEUIPlugin.java:98) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Adding the getAnchor() call does seem to prevent the NPE. However now restoring RSE is failing at about the same frequency that the NPE was occurring. I'm using the following code: while (!RSECorePlugin.getThePersistenceManager().isRestoreComplete() && timeout < 5) { System.out.println("waiting for restore..."); try { Thread.sleep(1000); timeout++; } catch (InterruptedException e) { } } Even after 5 timeouts, RSE still has not restored.
(In reply to comment #7) > Adding the getAnchor() call does seem to prevent the NPE. However now > restoring RSE is failing at about the same frequency that the NPE was > occurring. What do you mean by "same frequency" ? Does it ever work? Do you see any other errors logged e.g. "OSGI ..bundle activation..gave up after waiting 5000 msec"...? Are you on HEAD of RSE for all plugins or working off a released build? Thanks
(In reply to comment #8) > (In reply to comment #7) > > Adding the getAnchor() call does seem to prevent the NPE. However now > > restoring RSE is failing at about the same frequency that the NPE was > > occurring. > > What do you mean by "same frequency" ? Does it ever work? Yes, it works about half of the time, which is pretty weird, but I guess indicative of a race condition. I was seeing the NPE about half of the time also, but the change to getAnchor() seems to have solved that. > Do you see any other errors logged e.g. "OSGI ..bundle activation..gave up > after waiting 5000 msec"...? Nothing is shown in the error log. > Are you on HEAD of RSE for all plugins or working off a released build? I'm using HEAD as of yesterday.
Changing OS from Mac OS to Mac OS X as per bug 185991
It turns out that the method for waiting for RSE to initialize as outlined in comment #7, is not quite correct. Here is better code: Job[] jobs = Job.getJobManager().find(null); for(int i=0; i<jobs.length; i++) { if ("Initialize RSE".equals(jobs[i].getName())) { //$NON-NLS-1$ jobs[i].join(); break; } } In case this runs during system initialization, it finds the InitRSEJob and waits for its completion. This does slightly more than just waiting for the persistence manager, so it's more robust; we are also using this in our unit tests, as per bug #198956. Please try using this code, and I'm confident the problem should be gone.
(In reply to comment #11) > It turns out that the method for waiting for RSE to initialize as outlined in > comment #7, is not quite correct. Here is better code: > > > Job[] jobs = Job.getJobManager().find(null); > for(int i=0; i<jobs.length; i++) { > if ("Initialize RSE".equals(jobs[i].getName())) { //$NON-NLS-1$ > jobs[i].join(); > break; > } > } > strange thing - this code produces *sometimes* a deadlock (the join method call to be concrete). i can definitely reproduce the deadlock. just execute this code inside a Eclipse build thread (in my case an incremetal builder). is that issue relying to swt threading ?
(In reply to comment #12) > to be concrete). i can definitely reproduce the deadlock. just execute this > code inside a Eclipse build thread (in my case an incremetal builder). It's quite natural that this can produce a deadlock. You're waiting for another thread, so if you own any resources that are needed by that other thread you're deadlocking. In other words, your thread apparently owns some resources which are needed by the InitRSEJob to complete. Having it deadlock "sometimes" may depend on the time when your thread starts locking the resources: If InitRSEJob is already done with them at the time you grab them, you'll not deadlock. Since you mention the build thread, I suppose that your thread owns an ISchedulingRule (resource, project, ...) which the InitRSEJob needs to complete. Note that this deadlock is independent of the method you use for waiting for the InitRSEJob to complete. You must ensure that you free the resources it needs, before you start waiting for it. You'll need to debug this yourself, to understand what resources you are holding on to. To debug it, you can a) Launch you app in debugger - suspend everything when it deadlocks - look at what resource the InitRSEJob is trying to acquire b) Launch you app from commandline on UNIX - do kill -SIGQUIT (java-pid) to get a thread dump to stdout c) Launch you app with -vmargs -Dcom.sun.management.jmxremote Then, start jconsole, attach to the app, look at the thread dump d) With your app deadlocking, webstart this app to get a thread dump: http://www.adaptj.com/root/main/download
*** Bug 202040 has been marked as a duplicate of this bug. ***
See also the code in bug 202040 comment 1 for properly waiting for the RSE model to restore. If this still doesn't help, try activating the RSEUIPlugin already in your Activator.start() method: public class MyPlugin extends plugin { /* ... */ public void start(BundleContext context) throws Exception { //Activate RSE and load profiles eagerly RSEUIPlugin.getDefault(); } }
I am closing this bug as it appears to be fixed by changing the client code. If there are still problems please reopen and add the appropriate description. Thanks!
*** Bug 205338 has been marked as a duplicate of this bug. ***