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

Bug 359554

Summary: Regression: Changing saved user ID while connecting disconnects existing subsystems
Product: [Tools] Target Management Reporter: Martin Oberhuber <mober.at+eclipse>
Component: RSEAssignee: Martin Oberhuber <mober.at+eclipse>
Status: RESOLVED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: major    
Priority: P2 CC: dmcknigh
Version: 3.3.1Flags: dmcknigh: review+
Target Milestone: 3.4 M3   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 359573    
Attachments:
Description Flags
patch v1
none
patch v2 - dont disconnect none

Description Martin Oberhuber CLA 2011-09-30 08:19:46 EDT
CQ:WIND00295547
Build ID: RSE 3.3.1 on Eclipse 4.2m2 on Win7 (also reproduced on Linux)

When I change the user ID in the RSE "Enter Password" dialog while connecting a subsystem, and I save that new user ID, any other subsystems already connected on the same connection are disconnected.

This is a major problem because I may have been working on the other subsystems, so the plain fact of making another connection causes me to lose state. In a Wind River scenario, one of the subsystems actually launches a QEMU emulator which is then shut down due to RSE changing the default user ID, so I may even lose data. This is particularly nasty for subsystems that don't even require a user ID or password and are connected automatically ... these also get disconnected.

This is perceived as a regression since in RSE 3.2.x the "save user ID" box was turned off by default so users would unlikely run into this situation; in RSE 3.3 with the "save user ID" on by default, I'm much more likely to shoot myself when changing the default user ID.

Steps to reproduce:
1. Create a new connection of type "Unix" or "Linux"
2. Choose "FTP Files" subsystem
3. Skip over processes, then choose "SSH Shells" and "SSH Terminals" subsystems
4. Finish
5. Right-click the SSH Terminals > Launch Terminal. Login with user ID "user1".
6. Right-click the FTP Files > Connect...
7. Login with user ID "user2" and ensure that "save user ID" is on.
   --> The SSH Terminals session is disconnected
   --> FTP Files terminates with an obscure error
       ("java.net.ConnectException: Connection refused: connect)
Comment 1 Martin Oberhuber CLA 2011-09-30 08:53:11 EDT
Created attachment 204374 [details]
patch v1

The problem is in SystemRegistry#updateHost().

Attached is a first, very conservative patch which retains the current semantics but avoids disconnecting for just changing the default user ID when 
   (a) the connector service doesn't even support user ID's, or
   (b) the subsystem doesn't support connect/disconnect.

I'm wondering, though, whether a more radical approach is in order... right now, using the "steps to reproduce" when I don't save the new user ID as default in step 5 the other subsystem(s) are not disconnected and I end up with a connection where different subsystems are connected with different user ID's. 

Allowing this seems inconsistent compared to saving the default user ID which forces a subsystem disconnect... I can only assume that this is because the SSH subsystem's property "user id" shows "user1 (inherited)" so after saving a different default user ID that property wouldn't be correct any more for a connected subsystem. This dilemma could potentially be resolved by always saving a local user ID into the subsystem, but that might have different implications.
Comment 2 Martin Oberhuber CLA 2011-09-30 09:46:55 EDT
Created attachment 204381 [details]
patch v2 - dont disconnect

Here is a slightly more agressive patch: We don't disconnect any subsystems any more if only the default user ID changed.

This works fine in all my testing: subsystems with inherited default user ID remain connected, and the user ID is automatically converted from an inherited one to a local one. The local one is remembered during the current session; after a quit & restart, the default user ID is assumed again.

I believe that this behavior makes most sense for TM v3.4.
Comment 3 Martin Oberhuber CLA 2011-09-30 09:47:29 EDT
Dave M, could you please review this?

For our product, we'll also need a backport to 3.3.2 so I'd appreciate your comments as soon as you can.
Comment 4 David McKnight CLA 2011-09-30 10:00:13 EDT
Both patches appear okay to me but I prefer the second since I don't see any good reasons for automatically disconnecting connected connector services in response to id changes.
Comment 5 Martin Oberhuber CLA 2011-09-30 10:49:49 EDT
Thanks Dave. I have released patch v2 for 3.4m3.