Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tigerstripe-dev] Deadlock is still there

Title: Deadlock is still there
Hi Yuri, Andrey,

I am afraid the deadlock issue we’re been seen with the TAF is still there.

John can reproduce it consistently now. He is working on a “simpler” example to reproduce it so you can test.
I’m forwarding below an extract of a internal email thread, as well as a stacktrace that should highlight the problem. I’ll let John comment further as needed.

Could you please comment on John’s thoughts below?

Thanks,
Eric

....
Hi Eric / Richard,

I was looking at the code yesterday and it struck me that:
1) the reads to annotations always grab a write-lock for at least some of the time
2) the reads to annotations always have the potential to write accumulated resource changes to the DB
3) the annotations are resources and resources (the workspace) has its own locking mechanisms, but annotations uses its own different mechanism - I think the dead-locks might arise from this

So, what could we do? Well we could separate read from write I/F more so read:
a) never writes to disk and so never needs a write lock (will not interfere then with other resources / workspace)
b) in reads if there are unsaved resources we can copy the list, and then analyse in memory to add to results returned
c) in  read I/F we would never have to register resource-change listeners for the results because the results can never be changed (or of they are the changes are ignored) - read I/F would return annotation contents and not the Annotation objects which makes saving changes impossible (as we do in TS integration)

What do you think? Some efficiency savings at the very least and I think one long term answer to the dead-locks.
....

Hi Eric,

Here is the deadlock stack trace.... I will check in these tests so you can run them...

Rerun com.cisco.nm.vne.annotation.ird.auditandnaming.test.SimpleAuditTests [JUnit Plug-in Test]
 org.eclipse.equinox.launcher.Main at localhost:4111 (Suspended)
  Daemon System Thread [Attach Listener] (Suspended)
  Daemon System Thread [Signal Dispatcher] (Suspended)
  Daemon System Thread [Finalizer] (Suspended)
   Object.wait(long) line: not available [native method]
   ReferenceQueue<T>.remove(long) line: 116
   ReferenceQueue<T>.remove() line: 132
   Finalizer$FinalizerThread.run() line: 159
  Daemon System Thread [Reference Handler] (Suspended)
   Object.wait(long) line: not available [native method]
   Reference$Lock(Object).wait() line: 485
   Reference$ReferenceHandler.run() line: 116
  Thread [main] (Suspended)
   Object.wait(long) line: not available [native method]
   ThreadJob.joinRun(IProgressMonitor) line: 189
   ImplicitJobs.begin(ISchedulingRule, IProgressMonitor, boolean) line: 87
   JobManager.beginRule(ISchedulingRule, IProgressMonitor) line: 230
   WorkManager.checkIn(ISchedulingRule, IProgressMonitor) line: 117
   Workspace.prepareOperation(ISchedulingRule, IProgressMonitor) line: 1747
   File.setContents(InputStream, int, IProgressMonitor) line: 364
   File.setContents(InputStream, boolean, boolean, IProgressMonitor) line: 469
   PlatformResourceURIHandlerImpl$WorkbenchHelper$1(PlatformResourceURIHandlerImpl$PlatformResourceOutputStream).flush() line: 131
   AnnotationXMISave(XMLSaveImpl).writeAscii(OutputStream) line: 998
   AnnotationXMISave(XMLSaveImpl).save(XMLResource, OutputStream, Map<?,?>) line: 260
   AnnotationXMIResource(XMLResourceImpl).doSave(OutputStream, Map<?,?>) line: 205
   AnnotationXMIResource(ResourceImpl).save(OutputStream, Map<?,?>) line: 1344
   AnnotationXMIResource(ResourceImpl).save(Map<?,?>) line: 986
   ResourceHelper.save(Resource) line: 80
   ResourceHelper.removeAndSave(Resource, EObject) line: 73
   ResourceStorage.removeAndSave(EObject, Resource) line: 207
   EMFDatabase.doRemove(EObject, Resource[]) line: 467
   EMFDatabase.remove(EObject) line: 239
   AnnotationManager(AnnotationStorage).doRemove(URI) line: 177
   AnnotationManager(AnnotationStorage).remove(URI) line: 163
   AnnotationManager.removeAnnotations(Object) line: 327
   SimpleAuditTests(AuditTestsBase).tearDown() line: 151
   SimpleAuditTests.tearDown() line: 84
   SimpleAuditTests(TestCase).runBare() line: 136
   TestResult$1.protect() line: 106
   TestResult.runProtected(Test, Protectable) line: 124
   TestResult.run(TestCase) line: 109
   SimpleAuditTests(TestCase).run(TestResult) line: 120
   TestSuite.runTest(Test, TestResult) line: 230
   TestSuite.run(TestResult) line: 225
   JUnit3TestReference.run(TestExecution) line: 130
   TestExecution.run(ITestReference[]) line: 38
   RemotePluginTestRunner(RemoteTestRunner).runTests(String[], String, TestExecution) line: 460
   RemotePluginTestRunner(RemoteTestRunner).runTests(TestExecution) line: 673
   RemotePluginTestRunner(RemoteTestRunner).run() line: 386
   RemotePluginTestRunner.main(String[]) line: 62
   UITestApplication$1.run() line: 114
   RunnableLock.run() line: 35
   UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 133
   Display.runAsyncMessages(boolean) line: 3800
   Display.readAndDispatch() line: 3425
   Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2382
   Workbench.runUI() line: 2346
   Workbench.access$4(Workbench) line: 2198
   Workbench$5.run() line: 493
   Realm.runWithDefault(Realm, Runnable) line: 288
   Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 488
   PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149
   IDEApplication.start(IApplicationContext) line: 113
   UITestApplication.start(IApplicationContext) line: 46
   EclipseAppHandle.run(Object) line: 193
   EclipseAppLauncher.runApplication(Object) line: 110
   EclipseAppLauncher.start(Object) line: 79
   EclipseStarter.run(Object) line: 382
   EclipseStarter.run(String[], Runnable) line: 179
   NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
   NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
   DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
   Method.invoke(Object, Object...) line: 597
   Main.invokeFramework(String[], URL[]) line: 549
   Main.basicRun(String[]) line: 504
   Main.run(String[]) line: 1236
   Main.main(String[]) line: 1212
  Daemon Thread [Framework Event Dispatcher] (Suspended)
   Object.wait(long) line: not available [native method]
   EventManager$EventThread(Object).wait() line: 485
   EventManager$EventThread.getNextEvent() line: 377
   EventManager$EventThread.run() line: 317
  Daemon Thread [Start Level Event Dispatcher] (Suspended)
   Object.wait(long) line: not available [native method]
   EventManager$EventThread(Object).wait() line: 485
   EventManager$EventThread.getNextEvent() line: 377
   EventManager$EventThread.run() line: 317
  Thread [Worker-0] (Suspended)
   Object.wait(long) line: not available [native method]
   WorkerPool.sleep(long) line: 185
   WorkerPool.startJob(Worker) line: 217
   Worker.run() line: 51
  Daemon Thread [Java indexing] (Suspended)
   Object.wait(long) line: not available [native method]
   IndexManager(Object).wait() line: 485
   IndexManager(JobManager).run() line: 371
   Thread.run() line: 619
  Thread [Timer-0] (Suspended)
   Object.wait(long) line: not available [native method]
   TimerThread.mainLoop() line: 509
   TimerThread.run() line: 462
  Thread [Worker-1] (Suspended)
   Object.wait(long) line: not available [native method]
   WorkerPool.sleep(long) line: 185
   WorkerPool.startJob(Worker) line: 217
   Worker.run() line: 51
  Thread [WorkbenchTestable] (Suspended)
   Object.wait(long) line: not available [native method]
   RunnableLock(Object).wait() line: 485
   UISynchronizer(Synchronizer).syncExec(Runnable) line: 185
   UISynchronizer.syncExec(Runnable) line: 150
   Display.syncExec(Runnable) line: 4251
   WorkbenchTestable.runTest(Runnable) line: 109
   UITestApplication.runTests() line: 112
   WorkbenchTestable$1.run() line: 68
   Thread.run() line: 619
  Thread [Worker-2] (Suspended)
   Object.wait(long) line: not available [native method]
   OfflineCachingStorage$CacheFlushJob(Object).wait() line: 485
   OfflineCachingStorage$CacheFlushJob.run(IProgressMonitor) line: 239
   Worker.run() line: 55
  Thread [Worker-3] (Suspended)
   Unsafe.park(boolean, long) line: not available [native method]
   LockSupport.park(Object) line: 158
   ReentrantReadWriteLock$NonfairSync(AbstractQueuedSynchronizer).parkAndCheckInterrupt() line: 747
   ReentrantReadWriteLock$NonfairSync(AbstractQueuedSynchronizer).acquireQueued(AbstractQueuedSynchronizer$Node, int) line: 778
   ReentrantReadWriteLock$NonfairSync(AbstractQueuedSynchronizer).acquire(int) line: 1114
   ReentrantReadWriteLock$WriteLock.lock() line: 807
   EMFDatabase.lockAndUpdate(boolean) line: 175
   EMFDatabase.get(EStructuralFeature, Object) line: 251
   AnnotationManager(AnnotationStorage).doGetAnnotations(URI) line: 128
   AnnotationManager(AnnotationStorage).getAnnotations(URI) line: 110
   AnnotationManager.getAnnotations(Object, boolean) line: 313
   IrdValidationRules.hasAnnotations(ITigerstripeModelProject, Class<?>) line: 204
   IrdValidationRules.setDetails(IProject, IAbstractArtifact) line: 189
   AbstractArtifactAuditor$1.run() line: 130
   SafeRunner.run(ISafeRunnable) line: 37
   DependencyArtifactAuditor(AbstractArtifactAuditor).run(IProgressMonitor) line: 124
   DependencyArtifactAuditor.run(IProgressMonitor) line: 31
   TigerstripeProjectAuditor.processPendingAudits(IProgressMonitor) line: 178
   TigerstripeProjectAuditor.build(int, Map, IProgressMonitor) line: 380
   BuildManager$2.run() line: 633
   SafeRunner.run(ISafeRunnable) line: 37
   BuildManager.basicBuild(int, IncrementalProjectBuilder, Map, MultiStatus, IProgressMonitor) line: 170
   BuildManager.basicBuild(IProject, int, ICommand[], MultiStatus, IProgressMonitor) line: 201
   BuildManager$1.run() line: 253
   SafeRunner.run(ISafeRunnable) line: 37
   BuildManager.basicBuild(IProject, int, MultiStatus, IProgressMonitor) line: 256
   BuildManager.basicBuildLoop(IProject[], IProject[], int, MultiStatus, IProgressMonitor) line: 309
   BuildManager.build(int, IProgressMonitor) line: 341
   AutoBuildJob.doBuild(IProgressMonitor) line: 140
   AutoBuildJob.run(IProgressMonitor) line: 238
   Worker.run() line: 55
  Thread [Worker-4] (Suspended)
   Object.wait(long) line: not available [native method]
   WorkerPool.sleep(long) line: 185
   WorkerPool.startJob(Worker) line: 217
   Worker.run() line: 51
  Thread [Worker-5] (Suspended)
   Object.wait(long) line: not available [native method]
   WorkerPool.sleep(long) line: 185
   WorkerPool.startJob(Worker) line: 217
   Worker.run() line: 51
  Thread [Worker-6] (Suspended)
   Object.wait(long) line: not available [native method]
   WorkerPool.sleep(long) line: 185
   WorkerPool.startJob(Worker) line: 217
   Worker.run() line: 51
  Thread [Timer-1] (Suspended)
   Object.wait(long) line: not available [native method]
   TimerThread.mainLoop() line: 509
   TimerThread.run() line: 462
  Daemon Thread [YJP-Plugin-RequestListener] (Suspended)
   PlainSocketImpl.socketAccept(SocketImpl) line: not available [native method]
   SocksSocketImpl(PlainSocketImpl).accept(SocketImpl) line: 384
   ServerSocket.implAccept(Socket) line: 453
   ServerSocket.accept() line: 421
   i$1.run() line: 7
   Thread.run() line: 619
  Thread [Worker-7] (Suspended)
   Object.wait(long) line: not available [native method]
   WorkerPool.sleep(long) line: 185
   WorkerPool.startJob(Worker) line: 217
   Worker.run() line: 51
  Thread [ReaderThread] (Suspended)
   SocketInputStream.socketRead0(FileDescriptor, byte[], int, int, int) line: not available [native method]
   SocketInputStream.read(byte[], int, int) line: 129
   StreamDecoder.readBytes() line: 264
   StreamDecoder.implRead(char[], int, int) line: 306
   StreamDecoder.read(char[], int, int) line: 158
   InputStreamReader.read(char[], int, int) line: 167
   BufferedReader.fill() line: 136
   BufferedReader.readLine(boolean) line: 299
   BufferedReader.readLine() line: 362
   RemoteTestRunner$ReaderThread.run() line: 140
 C:\jdk1.6.0_05\bin\javaw.exe (17 Sep 2008 10:31:12)




Back to the top