From 00c3798ec6821c5a3c94771c2560c1ee58c7e023 Mon Sep 17 00:00:00 2001 From: Daniel Roberts ddanielr Date: Thu, 15 Oct 2026 04:11:12 +0000 Subject: [PATCH] Fixed possible deadlock issue during fixSplit This code held a lock for `server.openingTablets` but would attempt to modify `server.unopenedTablets` without holding that lock. Other sections of code that lock on these Sets always try to lock `server.unopenedTablets` first. This section of the code doesn't do that and could result in a dead lock situation. --- .../accumulo/tserver/AssignmentHandler.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/AssignmentHandler.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/AssignmentHandler.java index e6154e1392e..b69d65bb435 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/AssignmentHandler.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/AssignmentHandler.java @@ -115,17 +115,19 @@ public void run() { KeyExtent fixedExtent = ManagerMetadataUtil.fixSplit(server.getContext(), tabletMetadata, server.getLock()); - synchronized (server.openingTablets) { - server.openingTablets.remove(extent); - server.openingTablets.notifyAll(); - // it expected that the new extent will overlap the old one... if it does not, it - // should not be added to unopenedTablets - if (!KeyExtent.findOverlapping(extent, new TreeSet<>(Arrays.asList(fixedExtent))) - .contains(fixedExtent)) { - throw new IllegalStateException( - "Fixed split does not overlap " + extent + " " + fixedExtent); + synchronized (server.unopenedTablets) { + synchronized (server.openingTablets) { + server.openingTablets.remove(extent); + server.openingTablets.notifyAll(); + // it expected that the new extent will overlap the old one... if it does not, it + // should not be added to unopenedTablets + if (!KeyExtent.findOverlapping(extent, new TreeSet<>(Arrays.asList(fixedExtent))) + .contains(fixedExtent)) { + throw new IllegalStateException( + "Fixed split does not overlap " + extent + " " + fixedExtent); + } + server.unopenedTablets.add(fixedExtent); } - server.unopenedTablets.add(fixedExtent); } // split was rolled back... try again new AssignmentHandler(server, fixedExtent).run();