Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325501 - Handle terminating debug session when peer is disconnected
Summary: Handle terminating debug session when peer is disconnected
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-edc (show other bugs)
Version: 8.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ed Swartz CLA
QA Contact: Ken Ryall CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-16 13:16 EDT by Ed Swartz CLA
Modified: 2011-05-13 10:53 EDT (History)
0 users

See Also:
ed.swartz: review? (ken.ryall)


Attachments
proposed patch (11.91 KB, patch)
2010-09-16 13:16 EDT, Ed Swartz CLA
no flags Details | Diff
updated patch (15.24 KB, patch)
2010-09-16 20:59 EDT, Ed Swartz CLA
cdtdoug: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Swartz CLA 2010-09-16 13:16:26 EDT
EDC can create TCF channels on behalf of clients but is not listening to errors or close events on those channels.  

Thus, when debugging under EDC and a debug agent dies or a device is disconnected, the EDC session will usually sit waiting for a long time.  Terminating the session through the UI will further hang because EDC tries to send commands on the dead channel and wait for responses.

Also, just in general, it's a bit of a hack in other parts of EDC to interact with peers and channels that EDC has created internally (i.e. via TCFServiceManager#getPeerService).  ITCFServiceManager only exposes a way to get an existing channel on a peer, but no way to directly discover what channels it has opened internally on a peer via #getChannelForPeer().  

I propose solving both of these problems in a general way by allowing clients to register a listeners on ITCFServiceManager, which informs when an IPeer/IChannel combination is opened or closed.  

Then, the AbstractFinalLaunchSequence#initFindPeerStep() can add such a listener and terminate the debug session when its peer/channel tuple dies.

QUESTION: what is the proposed way to alert the user when the debug session is killed?  I.e. are we allowed to put up UI?
Comment 1 Ed Swartz CLA 2010-09-16 13:16:52 EDT
Created attachment 179053 [details]
proposed patch
Comment 2 Ed Swartz CLA 2010-09-16 20:59:37 EDT
Created attachment 179079 [details]
updated patch

This is another revision which allows a subclass to control how it reacts to the connection closed event and improves the Javadoc.  Does this look safe, Ken?
Comment 3 Ed Swartz CLA 2010-09-17 14:39:19 EDT
I merged in these changes to sync with our product build.