You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2023/01/02 12:09:26 UTC

[jackrabbit-oak] branch 1.22 updated: OAK-9356: DocumentNodeStore: in dispose(), improve lease update diagnostics

This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch 1.22
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


The following commit(s) were added to refs/heads/1.22 by this push:
     new 8858b328f6 OAK-9356: DocumentNodeStore: in dispose(), improve lease update diagnostics
8858b328f6 is described below

commit 8858b328f66991a3884f10ed5e122700cc31f03a
Author: Julian Reschke <re...@apache.org>
AuthorDate: Fri Feb 19 18:41:34 2021 +0000

    OAK-9356: DocumentNodeStore: in dispose(), improve lease update diagnostics
    
    git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1886696 13f79535-47bb-0310-9956-ffa450edef68
---
 .../oak/plugins/document/ClusterNodeInfo.java       |  2 +-
 .../oak/plugins/document/DocumentNodeStore.java     | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java
index 9289cce6a3..eca976cc78 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/ClusterNodeInfo.java
@@ -835,7 +835,7 @@ public class ClusterNodeInfo {
      * @return {@code true} if the lease is considered expired, {@code false}
      *         otherwise.
      */
-    private boolean isLeaseExpired(long time) {
+    protected boolean isLeaseExpired(long time) {
         return time >= (leaseEndTime - leaseFailureMargin);
     }
 
diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
index fcc0ac255b..637c51f8f4 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStore.java
@@ -883,6 +883,27 @@ public final class DocumentNodeStore
 
         Utils.joinQuietly(clusterUpdateThread);
 
+        // attempt diagnostics on lease update thread
+        boolean isLeaseExpired = clusterNodeInfo.isLeaseExpired(clock.getTime());
+        Thread.State leaseUpdateState = leaseUpdateThread.getState();
+        if (leaseUpdateState == Thread.State.TERMINATED) {
+            LOG.error("leaseUpdateThread (" + leaseUpdateThread.getName() + ") is terminated");
+        }
+
+        if (isLeaseExpired || LOG.isDebugEnabled()) {
+            StringBuilder message = new StringBuilder(
+                    "Status of lease update thread (" + leaseUpdateThread.getName() + "): " + leaseUpdateState + "; Stack Trace:");
+            for (StackTraceElement se : leaseUpdateThread.getStackTrace()) {
+                message.append("\n\tat ");
+                message.append(se.toString());
+            }
+            if (isLeaseExpired) {
+                LOG.info(message.toString());
+            } else {
+                LOG.debug(message.toString());
+            }
+        }
+
         // Stop lease update thread once no further document store operations
         // are required
         LOG.debug("Stopping LeaseUpdate thread...");