Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312813 - [Launch] MIInferiorProcess.exitValue() never returns.
Summary: [Launch] MIInferiorProcess.exitValue() never returns.
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 7.0   Edit
Assignee: Pawel Piech CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
: 312267 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-05-13 12:21 EDT by Navid Mehregani CLA
Modified: 2010-07-28 15:27 EDT (History)
2 users (show)

See Also:
pawel.1.piech: review? (marc.khouzam)


Attachments
Debug View Snapshot (69.06 KB, image/png)
2010-05-13 12:21 EDT, Navid Mehregani CLA
no flags Details
Full stack trace (15.00 KB, text/plain)
2010-05-13 12:22 EDT, Navid Mehregani CLA
no flags Details
Possible fix. (1.09 KB, patch)
2010-05-14 11:41 EDT, Pawel Piech CLA
no flags Details | Diff
More localized fix. (1.36 KB, patch)
2010-05-14 12:16 EDT, Pawel Piech CLA
cdtdoug: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Navid Mehregani CLA 2010-05-13 12:21:34 EDT
Created attachment 168408 [details]
Debug View Snapshot

I'm running into a deadlock when terminating a DSF-GDB debug session.  The problem is intermittent.  I'm not sure if it's related to my workspace, but I can attach it if need be.  

I attached a remote debugger to the hanged workbench.  Please see attached snapshot for the stack trace.  Here's what seems to be happening:
UI Thread is waiting for Daemon Thread [Process Monitor]
Daemon Thread[Process Monitor] is executing something synchronously on session executor.
However, session executor is no where to be found.  I believe it's already been disposed.

The latest changes in MIInferiorProcess class point to bug#304146.  This might be a regression due to the fix for this bug.
Comment 1 Navid Mehregani CLA 2010-05-13 12:22:15 EDT
Created attachment 168409 [details]
Full stack trace
Comment 2 Pawel Piech CLA 2010-05-13 14:00:29 EDT
The deadlock part is a duplicate of 311813 (note the similar bug numbers... conicidence or AI? ;-))  But the more interesting bit is what happened to the exitValue() query.

The exitValue query has several guards against the executor shutting down:
1) If the exitCodeQuery is submitted to a shut down executor, it'll throw a RejectedExecutionException.

2) Calling ICommandControlService.queueCommand() after service has shut down should complete with an error immediately.

3) If command control shuts down while command is in queue, the command control will complete the RM with an error.

4) If the executor shuts down just before command control completes the command RM, the RM will propagate the rejected execution exception error to the queue RM.


The only possible failing point I can see is the isSessionActive() test handling at the beginning of the query.
Comment 3 Pawel Piech CLA 2010-05-14 11:41:04 EDT
Created attachment 168553 [details]
Possible fix.

Navid, any chance you could try this fix.
Comment 4 Pawel Piech CLA 2010-05-14 12:16:31 EDT
Created attachment 168559 [details]
More localized fix.

This is a more localized fix in the Query object.  It would address the same issue.  I will go ahead and commit this fix as well as cleanup of the Query.cancel() use elsewhere in DSF and DSF/GDB.
Comment 5 Pawel Piech CLA 2010-05-14 13:02:18 EDT
I committed the changes, Marc if you get a chance, please review.
Comment 6 Marc Khouzam CLA 2010-05-14 20:37:19 EDT
The new Query code is a bit of a mystery to me (as was the old one :-)), so I can't be much help right now.  Hopefully I can get to the review I have pending for the new Query code, and things will make more sense.
Comment 7 Navid Mehregani CLA 2010-05-17 22:25:00 EDT
(In reply to comment #3)
> Created an attachment (id=168553) [details]
> Possible fix.
> 
> Navid, any chance you could try this fix.

Pawel, it looks good to me.
Comment 8 Pawel Piech CLA 2010-05-20 18:37:12 EDT
*** Bug 312267 has been marked as a duplicate of this bug. ***
Comment 9 CDT Genie CLA 2010-07-28 15:27:41 EDT
*** cdt cvs genie on behalf of ppiech ***
Bug 312813 -  [Launch] MIInferiorProcess.exitValue() never returns

[*] MIInferiorProcess.java 1.8 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/MIInferiorProcess.java?root=Tools_Project&r1=1.7&r2=1.8

[*] Query.java 1.5 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/concurrent/Query.java?root=Tools_Project&r1=1.4&r2=1.5

[*] DsfCastToTypeSupport.java 1.4 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/viewmodel/DsfCastToTypeSupport.java?root=Tools_Project&r1=1.3&r2=1.4

[*] ModuleDetailPane.java 1.5 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/modules/detail/ModuleDetailPane.java?root=Tools_Project&r1=1.4&r2=1.5

[*] SyncRegisterDataAccess.java 1.2 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/register/SyncRegisterDataAccess.java?root=Tools_Project&r1=1.1&r2=1.2

[*] SyncVariableDataAccess.java 1.6 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/viewmodel/variable/SyncVariableDataAccess.java?root=Tools_Project&r1=1.5&r2=1.6

[*] TriggerCellModifier.java 1.2 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/TriggerCellModifier.java?root=Tools_Project&r1=1.1&r2=1.2

[*] DsfQueryTests.java 1.3 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf/org.eclipse.cdt.tests.dsf/src/org/eclipse/cdt/tests/dsf/concurrent/DsfQueryTests.java?root=Tools_Project&r1=1.2&r2=1.3