[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Deadlock on launch due to CBreakpointManager

Yes, I see :( It doesn't happen on my machine and I usually turn the autobuild off. And I agree completely with your comment about starting a job from a synchronized block. This was overlooked when we moved to the event-based breakpoint settings. Please, submit a bug report.
Unfortunately, at the moment I don't see a simple solution for the 3.1 release.


Thank you,
Mikhail Khodjaiants
----- Original Message ----- From: "Ryan Hapgood" <ryan@xxxxxxxxxx>
To: "CDT General developers list." <cdt-dev@xxxxxxxxxxx>
Sent: Wednesday, June 07, 2006 11:40 PM
Subject: [cdt-dev] Deadlock on launch due to CBreakpointManager



Before I go creating a new bug report I was hoping to get some opinions on the following deadlock. I'm not running HEAD so I can't guarantee it'll occur for everybody, but the code (HEAD) seems to still suffer.
To reproduce try:


- clear workspace
- new managed make project with autobuild
- create a new file in project, add code and save
- add breakpoint
- create launch with stop on main
- run launch

Thread 1:

AutoBuildJob (owns workspace job queue) -> ... -> BreakpointManager.resourceChanged(...) -> CBreakpointManager.breakpointsChanged(...)

public void breakpointsChanged( IBreakpoint[] breakpoints, IMarkerDelta[] deltas ) {
ArrayList removeList = new ArrayList( breakpoints.length );
ArrayList installList = new ArrayList( breakpoints.length );
synchronized ( getBreakpointMap() ) { ###### Waiting for map to become free ####



Thread 2:

EventManager -> CBreakpointManager.handleDebugEvents(...) -> handleBreakpointCreatedEvent(...) -> doHandleLocationBreakpointCreatedEvent(...)

private void doHandleLocationBreakpointCreatedEvent ( ICDILocationBreakpoint cdiBreakpoint ) {
if ( cdiBreakpoint.isTemporary() )
return;
ICBreakpoint breakpoint = null;
synchronized( getBreakpointMap() ) { ####### Has lock on map #######
breakpoint = getBreakpointMap().getCBreakpoint( cdiBreakpoint );
if ( breakpoint == null ) {
breakpoint = createLocationBreakpoint( cdiBreakpoint ); ####### Requires job to execute on workspace job queue #####
}
if ( breakpoint != null )
getBreakpointMap().put( breakpoint, cdiBreakpoint );
}


public CBreakpoint( final IResource resource, final String markerType, final Map attributes, final boolean add ) throws CoreException {
this();
IWorkspaceRunnable wr = new IWorkspaceRunnable() {


public void run( IProgressMonitor monitor ) throws CoreException {
// create the marker
setMarker( resource.createMarker( markerType ) );
// set attributes
ensureMarker().setAttributes( attributes );
//set the marker message
setAttribute( IMarker.MESSAGE, getMarkerMessage() );
// add to breakpoint manager if requested
register( add );
}
};
run( wr ); ##### Cannot execute due to AutoBuildJob waiting to complete ##########
}




I'm not sure if having a job queued inside the synchronise is a good idea, for this exact reason. Any comments are much appreciated.

Ryan Hapgood,
HI-TECH Software

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev