Carsten Pfeiffer created IVYDE-361:
--------------------------------------

             Summary: Deadlock in classpath container
                 Key: IVYDE-361
                 URL: https://issues.apache.org/jira/browse/IVYDE-361
             Project: IvyDE
          Issue Type: Bug
          Components: classpath container
            Reporter: Carsten Pfeiffer


The change in IvyClasspathContainer (asyncExec -> syncExec) may unfortunately 
lead to deadlock situations. If the main thread attempts to execute a job while 
the resolve job is already running, the main thread waits for the resolve job 
to finish. The latter then attempts to syncExec() into the main thread, which 
won't work.

I'm wondering why the IvyClasspathContainer (now Impl) needs to syncExec() or 
asyncExec() at all. Do you remember why it cannot update the classpath in the 
background thread?

{code}
Thread [Worker-4] (Suspended)   
        waiting for: RunnableLock  (id=122)     
        Object.wait(long) line: not available [native method]   
        RunnableLock(Object).wait() line: 503   
        Synchronizer.syncExec(Runnable) line: 187       
        Display.syncExec(Runnable) line: 4330   
        IvyClasspathContainerImpl.setClasspathEntries(IClasspathEntry[]) line: 
148      
        IvyClasspathContainerImpl.updateClasspathEntries(IClasspathEntry[]) 
line: 144   
        IvyClasspathResolver.postBatchResolve() line: 40        
        IvyResolveJob.doRun(IProgressMonitor) line: 263 
        IvyResolveJob.run(IProgressMonitor) line: 85    
        Worker.run() line: 54   
{code}

{code}
Thread [main] (Suspended)       
        owns: RunnableLock  (id=122)    
                waited by: Thread [Worker-4] (Suspended)        
        waiting for: Object  (id=123)   
        Object.wait(long) line: not available [native method]   
        Object.wait() line: 503 
        ThreadJob.waitForRun(ThreadJob, IProgressMonitor, InternalJob, Thread) 
line: 272        
        ThreadJob.joinRun(ThreadJob, IProgressMonitor) line: 199        
        ImplicitJobs.begin(ISchedulingRule, IProgressMonitor, boolean) line: 92 
        JobManager.beginRule(ISchedulingRule, IProgressMonitor) line: 286       
        WorkManager.checkIn(ISchedulingRule, IProgressMonitor) line: 118        
        Workspace.prepareOperation(ISchedulingRule, IProgressMonitor) line: 
2282        
        Folder(Resource).refreshLocal(int, IProgressMonitor) line: 1655 
        ExternalFoldersManager.createLinkFolder(IPath, boolean, IProject, 
IProgressMonitor) line: 155   
        ExternalFoldersManager.createLinkFolder(IPath, boolean, 
IProgressMonitor) line: 145     
        ExternalFolderChange.updateExternalFoldersIfNecessary(boolean, 
IProgressMonitor) line: 48       
        
SetContainerOperation(ChangeClasspathOperation).classpathChanged(ClasspathChange,
 boolean) line: 62     
        SetContainerOperation.executeOperation() line: 110      
        SetContainerOperation(JavaModelOperation).run(IProgressMonitor) line: 
728       
        Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, 
IProgressMonitor) line: 2344    
        
SetContainerOperation(JavaModelOperation).runOperation(IProgressMonitor) line: 
793      
        JavaCore.setClasspathContainer(IPath, IJavaProject[], 
IClasspathContainer[], IProgressMonitor) line: 4952       
        IvyClasspathContainerImpl.notifyUpdateClasspathEntries() line: 172      
        IvyClasspathContainerImpl$1.run() line: 162     
        RunnableLock.run() line: 35     
        Synchronizer.runAsyncMessages(boolean) line: 135        
        Display.runAsyncMessages(boolean) line: 3563    
        Display.readAndDispatch() line: 3212    
...
{code}

(This is basically a copy of my comments to the already close IVYDE-259.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to