CalculatedValueCache Deadlock [message #1744573] |
Wed, 28 September 2016 13:15 |
Chris Lingwood Messages: 5 Registered: August 2014 |
Junior Member |
|
|
I appear to be getting a deadlock from the calculated value cache which I'm using for thumbnails (with custom painter) in my table (if there is a better way please shout).
The calulcated value cache worker thread fires a layer event which propagates throug the layers ending with a Display.syncExec (because it started in a worker thread). So far so good.
Unfortunately the main thread is busy trying to aquire a lock from eventHelperLock so this never happens. The lock can't be aquired because the calculated value cache worker thread has it (it is named as the "first reader" in the ReentrantReadWriteLock's sync object.
Most of the time this code works fine but it will inevitably go wrong occasionally. Especially when scrolling or repainting from a sort or filter.
It looks to me like a bug in the calculated value cache but I could well have things configured non optimally. Any thoughts?
Thanks!
Edit: I should also mention this is nattable 1.5.0 and an eclipse neon rcp application.
Calculated value cache worker thread.
Thread [pool-8-thread-144] (Suspended)
waiting for: RunnableLock (id=511)
Object.wait(long) line: not available [native method]
RunnableLock(Object).wait() line: 502 [local variables unavailable]
Synchronizer.syncExec(Runnable) line: 246
Display.syncExec(Runnable) line: 4813
NatTable$3.getClientArea() line: 335
GridLayer(CompositeLayer).getChildClientArea(int, int) line: 682
CompositeLayer.access$3(CompositeLayer, int, int) line: 679
CompositeLayer$1.getClientArea() line: 641
ViewportLayer.getClientAreaWidth() line: 1502
ViewportLayer.getColumnCount() line: 561
CellVisualChangeEvent.convertToLocal(ILayer) line: 63
ViewportLayer(AbstractLayer).handleLayerEvent(ILayerEvent) line: 260
ViewportLayer.handleLayerEvent(ILayerEvent) line: 1332
SelectionLayer(AbstractLayer).fireLayerEvent(ILayerEvent) line: 302
SelectionLayer(AbstractLayer).handleLayerEvent(ILayerEvent) line: 261
ColumnHideShowLayer(AbstractLayer).fireLayerEvent(ILayerEvent) line: 302
ColumnHideShowLayer(AbstractLayer).handleLayerEvent(ILayerEvent) line: 261
ColumnHideShowLayer(AbstractColumnHideShowLayer).handleLayerEvent(ILayerEvent) line: 50
ColumnHideShowLayer.handleLayerEvent(ILayerEvent) line: 66
ColumnReorderLayer(AbstractLayer).fireLayerEvent(ILayerEvent) line: 302
ColumnReorderLayer(AbstractLayer).handleLayerEvent(ILayerEvent) line: 261
ColumnReorderLayer.handleLayerEvent(ILayerEvent) line: 101
DataLayer(AbstractLayer).fireLayerEvent(ILayerEvent) line: 302
[b]CalculatedValueCache$1.run() line: 210[/b]
ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: 1142
ThreadPoolExecutor$Worker.run() line: 617 [local variables unavailable]
Thread.run() line: 745 [local variables unavailable]
Main thread:
Thread [main] (Suspended)
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.park(Object) line: 175
ReentrantReadWriteLock$NonfairSync(AbstractQueuedSynchronizer).parkAndCheckInterrupt() line: 836 [local variables unavailable]
ReentrantReadWriteLock$NonfairSync(AbstractQueuedSynchronizer).acquireQueued(AbstractQueuedSynchronizer$Node, int) line: 870
ReentrantReadWriteLock$NonfairSync(AbstractQueuedSynchronizer).acquire(int) line: 1199
ReentrantReadWriteLock$WriteLock.lock() line: 943 [local variables unavailable]
ViewportLayer(AbstractLayer).registerEventHandler(ILayerEventHandler<?>) line: 269
ViewportLayer.moveRowPositionIntoViewport(int) line: 976
ViewportLayer.moveCellPositionIntoViewport(int, int) line: 889
ViewportLayer.processSelection(CellSelectionEvent) line: 1443
ViewportLayer.handleLayerEvent(ILayerEvent) line: 1325
SelectionLayer(AbstractLayer).fireLayerEvent(ILayerEvent) line: 302
SelectionLayer.fireCellSelectionEvent(int, int, boolean, boolean, boolean) line: 592
SelectCellCommandHandler.doCommand(ILayer, SelectCellCommand) line: 42
SelectCellCommandHandler.doCommand(ILayer, ILayerCommand) line: 1
SelectionLayer(AbstractLayer).doCommand(ILayerCommand) line: 186
SelectionLayer(AbstractIndexLayerTransform).doCommand(ILayerCommand) line: 105
SelectionLayer.doCommand(ILayerCommand) line: 579
ViewportLayer(AbstractLayerTransform).doCommand(ILayerCommand) line: 106
ViewportLayer.doCommand(ILayerCommand) line: 1086
BodyLayerStack(AbstractLayerTransform).doCommand(ILayerCommand) line: 106
GridLayer.doCommandOnChildLayer(ILayerCommand, ILayer) line: 113
GridLayer.doCommandOnChildLayers(ILayerCommand) line: 99
GridLayer(CompositeLayer).doCommand(ILayerCommand) line: 136
GridLayer.doCommand(ILayerCommand) line: 187
NatTable.doCommand(ILayerCommand) line: 812
SelectCellAction.run(NatTable, MouseEvent) line: 25
ConfigurableModeEventHandler.mouseDown(MouseEvent) line: 45
ModeSupport.mouseDown(MouseEvent) line: 108
TypedListener.handleEvent(Event) line: 193
EventTable.sendEvent(Event) line: 84
Display.sendEvent(EventTable, Event) line: 4410
NatTable(Widget).sendEvent(Event) line: 1079
Display.runDeferredEvents() line: 4228
Display.readAndDispatch() line: 3816
PartRenderingEngine$4.run() line: 1121
Realm.runWithDefault(Realm, Runnable) line: 336
PartRenderingEngine.run(MApplicationElement, IEclipseContext) line: 1022
E4Workbench.createAndRunUI(MApplicationElement) line: 150
E4Application.start(IApplicationContext) line: 161
EclipseAppHandle.run(Object) line: 196
EclipseAppLauncher.runApplication(Object) line: 134
EclipseAppLauncher.start(Object) line: 104
EclipseStarter.run(Object) line: 388
EclipseStarter.run(String[], Runnable) line: 243
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 62
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 498
Main.invokeFramework(String[], URL[]) line: 673
Main.basicRun(String[]) line: 610
Main.run(String[]) line: 1519
Main.main(String[]) line: 1492
[Updated on: Wed, 28 September 2016 13:24] Report message to a moderator
|
|
|
|
Re: CalculatedValueCache Deadlock [message #1744587 is a reply to message #1744576] |
Wed, 28 September 2016 15:47 |
Chris Lingwood Messages: 5 Registered: August 2014 |
Junior Member |
|
|
Thanks for the quick reply.
Will do. I had a look through the source and it does aquire a readlock a few times as it propagates through but I couldn't see why it was claiming a write lock as well (that said some of the linked sources aren't working in my environment for some reason). The sync object did point at that thread though so it must have somewhere along the line.
I ended up using the calulcated value cache to allow faster painting. It seemed to give me lazy loading and caching "for free". I've got a table wtih 11k rows probably half of which have thumbnails. A full repaint without a cache or lazy loading (or for new items with just a cache) would need the loading, scaling and painting of 20odd thumbnails. The value cache just stores the ImageData so there is some overhead there but I'd run out of handles otherwise. I get a bit of flicker at the best of times.
Honestly I thought I'd got the idea from one of your posts but I can't find it anywhere. How would you have gone about it?
[Updated on: Wed, 28 September 2016 16:00] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03645 seconds