Working with GraphEngine for a while I very often find myself with a deadlocked thread while doing some operation against GraphEngine. Nested calls are definitely not on the menu. But now I encountered something strange:
foreach(long cellID ...)
{
byte[] buffer;
// the next line will block on the 54th call...
Global.LocalStorage.LoadCell(cellID, out buffer);
}
Suspecting a non-existing cellID I wrapped the call with
if(Global.LocalStorage.Contains(cellID))
{ ... }
But now this call blocks indefinitly.
Is this a bug? or
Under which conditions would the call block?
Cheerio, Andreas.
@Andreas Hassmann, I had met a similar issue, so I guess your trouble may be caused by the
...
in the foreach-loop.I used an iterator like
Global.LocalStorage.xxxCell_Accessor_Selector().Select(c => c.CellID.Value)
. In this case, the locks of the storage haven't been released which causes the deadlock whenGlobal.LocalStorage.LoadCell()
acquires the locks.If your problem is exact the same as mine, the solution will be to apply
.ToList()
to the iterator.Here are my codes to reproduce your problem.
The TSL:
The codes: