Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Dependency checking

This is an example of deadlock I got starting eclipse:

FIRST THREAD: Thread [main] (Suspended)
 IndexManager(JobManager).performConcurrentJob(IJob, int, IProgressMonitor)
line: 258
 DeltaProcessor.updateDependencies(ICElement) line: 521
 DeltaProcessor.updateCurrentDeltaAndIndex(IResourceDelta) line: 433
 DeltaProcessor.traverseDelta(ICElement, IResourceDelta) line: 370
 DeltaProcessor.traverseDelta(ICElement, IResourceDelta) line: 380
 DeltaProcessor.traverseDelta(ICElement, IResourceDelta) line: 380
 DeltaProcessor.processResourceDelta(IResourceDelta) line: 353
 CModelManager.resourceChanged(IResourceChangeEvent) line: 574
 NotificationManager$1.run() line: 137
 InternalPlatform.run(ISafeRunnable) line: 1006
 Platform.run(ISafeRunnable) line: 413
 NotificationManager.notify(ResourceChangeListenerList$ListenerEntry[],
IResourceChangeEvent, boolean) line: 152
 NotificationManager.broadcastChanges(ElementTree, int, boolean, boolean)
line: 67
 Workspace.broadcastChanges(ElementTree, int, boolean, boolean,
IProgressMonitor) line: 161
 Workspace.endOperation(boolean, IProgressMonitor) line: 892
 File(Resource).refreshLocal(int, IProgressMonitor) line: 1156
 CDocumentProvider(FileDocumentProvider).refreshFile(IFile) line: 711
 CDocumentProvider.createElementInfo(Object) line: 202
 CDocumentProvider(AbstractDocumentProvider).connect(Object) line: 306
 CEditor(AbstractTextEditor).doSetInput(IEditorInput) line: 2393
 CEditor(StatusTextEditor).doSetInput(IEditorInput) line: 162
 CEditor(TextEditor).doSetInput(IEditorInput) line: 476
 CEditor.doSetInput(IEditorInput) line: 172
 AbstractTextEditor$8.run(IProgressMonitor) line: 1882
 ModalContext.runInCurrentThread(IRunnableWithProgress, IProgressMonitor)
line: 302
 ModalContext.run(IRunnableWithProgress, boolean, IProgressMonitor, Display)
line: 252
 ApplicationWindow$1.run() line: 431
 BusyIndicator.showWhile(Display, Runnable) line: 69
 WorkbenchWindow(ApplicationWindow).run(boolean, boolean,
IRunnableWithProgress) line: 428
 WorkbenchWindow.run(boolean, boolean, IRunnableWithProgress) line: 1385
 CEditor(AbstractTextEditor).internalInit(IWorkbenchWindow, IEditorSite,
IEditorInput) line: 1897
 CEditor(AbstractTextEditor).init(IEditorSite, IEditorInput) line: 1914
 EditorManager.createSite(IEditorPart, EditorDescriptor, IEditorInput) line:
604
 EditorManager.openInternalEditor(IEditorReference, EditorDescriptor,
IEditorInput, boolean) line: 666
 EditorManager.access$7(EditorManager, IEditorReference, EditorDescriptor,
IEditorInput, boolean) line: 655
 EditorManager$7.run() line: 919
 InternalPlatform.run(ISafeRunnable) line: 1006
 Platform.run(ISafeRunnable) line: 413
 EditorManager.busyRestoreEditor(EditorManager$Editor, IMemento) line: 864
 EditorManager$6.run() line: 857
 BusyIndicator.showWhile(Display, Runnable) line: 69
 EditorManager.restoreEditor(EditorManager$Editor, IMemento) line: 853
 EditorManager.restoreState(IMemento) line: 756
 WorkbenchPage.restoreState(IMemento, IPerspectiveDescriptor) line: 2263
 WorkbenchWindow.restoreState(IMemento, IPerspectiveDescriptor) line: 1327
 Workbench.restoreState(IMemento) line: 1263
 Workbench.access$10(Workbench, IMemento) line: 1223
 Workbench$12.run() line: 1141
 InternalPlatform.run(ISafeRunnable) line: 1006
 Platform.run(ISafeRunnable) line: 413
 Workbench.openPreviousWorkbenchState() line: 1093
 Workbench.init(String[]) line: 870
 Workbench.run(Object) line: 1373
 InternalBootLoader.run(String, URL, String, String[], Runnable) line: 858
 BootLoader.run(String, URL, String, String[], Runnable) line: 461
 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
 NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 [local variables
unavailable]
 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 [local
variables unavailable]
 Method.invoke(Object, Object[]) line: 324 [local variables unavailable]
 Main.basicRun(String[]) line: 291
 Main.run(String[]) line: 747
 Main.main(String[]) line: 583

SECOND THREAD: Thread [CDT Indexer] (Suspended)
 Object.wait(long) line: not available [native method]
 Semaphore(Object).wait() line: 429 [local variables unavailable]
 Semaphore.acquire() line: 24
 UIWorkspaceLock(WorkspaceLock).acquire() line: 49
 UIWorkspaceLock.acquire() line: 46
 WorkManager.checkIn() line: 79
 Workspace.prepareOperation() line: 1558
 File(Resource).refreshLocal(int, IProgressMonitor) line: 1147
 FileDocumentProvider.refreshFile(IFile) line: 711
 FileDocumentProvider.createElementInfo(Object) line: 518
 FileDocumentProvider(AbstractDocumentProvider).connect(Object) line: 306
 MakeDocumentModel(QDEDocumentModel).<init>(IFileEditorInput) line: 42
 MakeDocumentModel.<init>(IFileEditorInput) line: 19
 MakeDocumentModel.<init>(IFile) line: 15
 MakeQNXCommonFile.open(IFile) line: 40
 MakeInfo.load(IFile) line: 751
 MakeInfo.init() line: 918
 MakeInfo.<init>(IProject) line: 92
 MakeInfoAdapterFactory.getAdapter(Object, Class) line: 39
 AdapterManager.getAdapter(Object, Class) line: 123
 QdeProjectInfo.<init>(IProject, BuildConfig) line: 74
 QdeCorePlugin.getProjectInfo(IProject) line: 158
 QDEMakeScannerProvider.getScannerInformation(IResource) line: 64
 SourceIndexer.indexFile(IDocument) line: 78
 SourceIndexer(AbstractIndexer).index(IDocument, IIndexerOutput) line: 353
 Index.add(IDocument, IIndexer) line: 110
 AddCompilationUnitToIndex.indexDocument(IIndex) line: 30
 AddCompilationUnitToIndex(AddFileToIndex).execute(IProgressMonitor) line:
39
 IndexManager(JobManager).run() line: 368
 Thread.run() line: 534 [local variables unavailable]

First thread locked workspace while refreshing file, then sent resource
change event and synchronously started IndexManajer.performConcurrentJob for
the Indexer. Idexer is running in another thread and implicitly trying to
lock workspace during executing of
FileDocumentProvider.connect(FileEditorInput) operation.

Another example: running Indexer after invoking Search C/C++ dialog.

FIRST THREAD: Thread [ModalContext] (Suspended)
 Thread.sleep(long) line: not available [native method]
 IndexManager(JobManager).performConcurrentJob(IJob, int, IProgressMonitor)
line: 269
 SearchEngine.search(IWorkspace, ICSearchPattern, ICSearchScope,
ICSearchResultCollector, boolean) line: 143
 CSearchOperation.execute(IProgressMonitor) line: 81
 WorkspaceModifyOperation$1.run(IProgressMonitor) line: 71
 Workspace.run(IWorkspaceRunnable, IProgressMonitor) line: 1595
 CSearchOperation(WorkspaceModifyOperation).run(IProgressMonitor) line: 85
 ModalContext$ModalContextThread.run() line: 101

Workspace.run is an atomic operation and implicitly locks workspace

SECOND THREAD: Thread [CDT Indexer] (Suspended)
 Object.wait(long) line: not available [native method]
 Semaphore(Object).wait() line: 429
 Semaphore.acquire() line: 24
 UIWorkspaceLock(WorkspaceLock).acquire() line: 49
 UIWorkspaceLock.acquire() line: 46
 WorkManager.checkIn() line: 79
 Workspace.prepareOperation() line: 1558
 File(Resource).refreshLocal(int, IProgressMonitor) line: 1147
 FileDocumentProvider.refreshFile(IFile) line: 711
 FileDocumentProvider.createElementInfo(Object) line: 518
 FileDocumentProvider(AbstractDocumentProvider).connect(Object) line: 306
 MakeDocumentModel(QDEDocumentModel).<init>(IFileEditorInput) line: 42
 MakeDocumentModel.<init>(IFileEditorInput) line: 19
 MakeDocumentModel.<init>(IFile) line: 15
 MakeQNXCommonFile.open(IFile) line: 40
 MakeInfo.load(IFile) line: 751
 MakeInfo.init() line: 918
 MakeInfo.<init>(IProject) line: 92
 MakeInfoAdapterFactory.getAdapter(Object, Class) line: 39
 AdapterManager.getAdapter(Object, Class) line: 123
 QdeProjectInfo.<init>(IProject, BuildConfig) line: 74
 QdeCorePlugin.getProjectInfo(IProject) line: 158
 QDEMakeScannerProvider.getScannerInformation(IResource) line: 64
 SourceIndexer.indexFile(IDocument) line: 78
 SourceIndexer(AbstractIndexer).index(IDocument, IIndexerOutput) line: 353
 Index.add(IDocument, IIndexer) line: 110
 AddCompilationUnitToIndex.indexDocument(IIndex) line: 30
 AddCompilationUnitToIndex(AddFileToIndex).execute(IProgressMonitor) line:
39
 IndexManager(JobManager).run() line: 368
 Thread.run() line: 534

I have the same sort of deadlock, just one of participants is different. Of
course I can try to devise something to avoid FileDocumentProvider.connect
(this stupid guy implicitly tries to lock workspace), but it doesn't seem to
me very reasonable: indexer shouldn't be dependable from any
workspace-update operation.





Back to the top