]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Trying to debug why LRU swap can be stuck in livelock 12/3612/1
authorjsimomaa <jani.simomaa@gmail.com>
Mon, 25 Nov 2019 07:00:08 +0000 (09:00 +0200)
committerjsimomaa <jani.simomaa@gmail.com>
Mon, 25 Nov 2019 07:00:08 +0000 (09:00 +0200)
gitlab #424

Change-Id: I7e933284969cebba28d36b25c1cdd51c0e49106d

bundles/org.simantics.acorn/src/org/simantics/acorn/lru/LRU.java

index b9ba72121858540c66e7c40d66990f196ecc7cea..205b79906d2d9acdf8da600669bbe2fa51d200fb 100644 (file)
@@ -293,8 +293,19 @@ public class LRU<MapKey,MapValue extends LRUObject<MapKey, MapValue>> {
                        if(valueToSwap.tryAcquireMutex()) {
                                try {
                                        if(valueToSwap.canBePersisted()) {
-                                               valueToSwap.persist();
-                                               return true;
+                                               boolean persist = valueToSwap.persist();
+                                               if (!persist) {
+                                                       LOGGER.error("\n Somehow valueToSwap {} could not be persisted even though canBePersisted returned true\n", valueToSwap);
+                                                       LOGGER.error("priorityQueue.size() {}", priorityQueue.size());
+                                                       if (priorityQueue.size() > 0) {
+                                                               LOGGER.error("priorityQueue first entry {}", priorityQueue.entrySet().iterator().next());
+                                                       }
+                                                       LOGGER.error("map.size() {}", map.size());
+                                                       if (map.size() > 0) {
+                                                               LOGGER.error("map first entry {}", map.entrySet().iterator().next());
+                                                       }
+                                               }
+                                               return persist;
                                        }
                                } catch (Throwable t) {
                                        throw new IllegalAcornStateException(t);