Uploaded image for project: 'IvyDE'
  1. IvyDE
  2. IVYDE-361

Deadlock in classpath container

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: master
    • Component/s: classpath container
    • Labels:
      None

      Description

      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?

      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	
      
      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	
      ...
      

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

        Attachments

          Activity

            People

            • Assignee:
              hibou Nicolas Lalevée
              Reporter:
              carsten.pfeiffer Carsten Pfeiffer
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: