Bug 206742 - [persistence] NPE in SystemRegistry.getHostsBySystemType()
Summary: [persistence] NPE in SystemRegistry.getHostsBySystemType()
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 2.0.1   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: 3.0 M4   Edit
Assignee: Martin Oberhuber CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
: 212404 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-10-18 07:55 EDT by Martin Oberhuber CLA
Modified: 2007-12-18 18:04 EST (History)
3 users (show)

See Also:
ddykstal.eclipse: review+


Attachments
Patch making SystemHostPool thread-safe (23.59 KB, patch)
2007-11-21 11:37 EST, Martin Oberhuber CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Oberhuber CLA 2007-10-18 07:55:49 EDT
During our nightly test runs with RSE 2.0.1, we saw the following NPE.
It seems that an IHost object is null at the time the SystemView runs a smartRefresh.

I'm wondering how an IHost object can ever be null in an RSE HostPool. It seems that there is either a concurrency / threading issue that should be addressed, or data have not been restored completely.

I would suggest reviewing related code, and perhaps adding checks to the methods dealing with IHost Objects, such that a "null" IHost object is detected as early as possible (when it's being added, and not when refreshing).

 [exec] Caused by: java.lang.NullPointerException
     [exec] 	at org.eclipse.rse.ui.internal.model.SystemRegistry.getHostsBySystemType(SystemRegistry.java:1495)
     [exec] 	at org.eclipse.rse.ui.internal.model.SystemRegistry.getLocalHost(SystemRegistry.java:1388)
     [exec] 	at com.windriver.ide.target.ui.rse.connections.WRConnectionManager.getRegistrySubSystem(WRConnectionManager.java:251)
     [exec] 	at com.windriver.ide.target.ui.rse.internal.elements.WRElementWrapperAdapter.getSubSystem(WRElementWrapperAdapter.java:109)
     [exec] 	at org.eclipse.rse.internal.ui.view.SystemView.smartRefresh(SystemView.java:3597)
     [exec] 	at org.eclipse.rse.internal.ui.view.SystemView$ResourceChangedJob.runInUIThread(SystemView.java:2048)
     [exec] 	at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:94)
     [exec] 	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
     [exec] 	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)


-----------Enter bugs above this line-----------
installation : eclipse-SDK-3.3.1 (M20070921-1145), cdt-4.0.1, emf-2.3.1
RSE install  : Download RSE-2.0.1: RSE-SDK,tests,terminal
java.runtime : Sun 1.5.0_11
os.name:     : Linux RHEL4
------------------------------------------------
Comment 1 Martin Oberhuber CLA 2007-11-21 11:37:29 EST
Created attachment 83441 [details]
Patch making SystemHostPool thread-safe

Attached patch makes SystemHostPool thread-safe, and adds some assertions to ensure that "null" IHost objects are detected as early as possible.

In order to ensure thread-safety, following changes were necessary:
  * make getHost(String) final
  * make getHost(int) final
  * avoid lazy initialization of "connections" and "pools" fields
  * Modify Javadoc of IHost#renamingSystemProfile() to allow alien method call
Comment 2 Martin Oberhuber CLA 2007-11-21 11:39:11 EST
Patch committed: [206742] Make SystemHostPool thread-safe
  SystemHostPool v1.5
  IHost v1.9
  SystemRegistry v1.38

DaveD please review.
Comment 3 Martin Oberhuber CLA 2007-12-10 09:36:44 EST
*** Bug 212404 has been marked as a duplicate of this bug. ***