ignite-1189: fixing deadlock
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4d528bec Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4d528bec Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4d528bec Branch: refs/heads/ignite-1093 Commit: 4d528becc1cd3db9d4d2d6db2053895043aa3918 Parents: 132562b Author: Denis Magda <dma...@gridgain.com> Authored: Tue Aug 4 13:04:35 2015 +0300 Committer: Denis Magda <dma...@gridgain.com> Committed: Tue Aug 4 13:04:35 2015 +0300 ---------------------------------------------------------------------- .../dht/atomic/GridDhtAtomicCache.java | 29 +++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4d528bec/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java index cd6e28d..470efdd 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java @@ -1176,6 +1176,12 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> { } catch (Exception e) { U.error(log, "Unexpected exception during cache update", e); + + res.addFailedKeys(keys, e); + + completionCb.apply(req, res); + + return; } if (remap) { @@ -2167,19 +2173,22 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> { // Enqueue entries while holding locks. Collection<KeyCacheObject> skip = null; - for (GridCacheMapEntry entry : locked) { - if (entry != null && entry.deleted()) { - if (skip == null) - skip = new HashSet<>(locked.size(), 1.0f); + try { + for (GridCacheMapEntry entry : locked) { + if (entry != null && entry.deleted()) { + if (skip == null) + skip = new HashSet<>(locked.size(), 1.0f); - skip.add(entry.key()); + skip.add(entry.key()); + } } } - - // Release locks. - for (GridCacheMapEntry entry : locked) { - if (entry != null) - UNSAFE.monitorExit(entry); + finally { + // Release locks. + for (GridCacheMapEntry entry : locked) { + if (entry != null) + UNSAFE.monitorExit(entry); + } } // Try evict partitions.