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

virajjasani pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.6 by this push:
     new ba424569318 HBASE-30320 TestMemStoreLAB#testLABChunkQueue OOM on fast 
hardware due to unbounded off-pool chunk allocation (#8533) (#8554)
ba424569318 is described below

commit ba424569318dbaeecbebac422c104cbac207df46
Author: Umesh <[email protected]>
AuthorDate: Thu Aug 20 19:28:44 2026 +0530

    HBASE-30320 TestMemStoreLAB#testLABChunkQueue OOM on fast hardware due to 
unbounded off-pool chunk allocation (#8533) (#8554)
    
    Signed-off-by: Duo Zhang <[email protected]>
    Signed-off-by: Andrew Purtell <[email protected]>
    Signed-off-by: Viraj Jasani <[email protected]>
---
 .../java/org/apache/hadoop/hbase/regionserver/TestMemStoreLAB.java | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreLAB.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreLAB.java
index 30e909b8c20..ce97de0c651 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreLAB.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreLAB.java
@@ -328,12 +328,19 @@ public class TestMemStoreLAB {
 
   private Thread getChunkQueueTestThread(final MemStoreLABImpl mslab, String 
threadName,
     Cell cellToCopyInto) {
+    // Reserve 20% of max heap as safety margin to prevent OOM on fast 
hardware where threads can
+    // allocate many GB of chunks within the 1-second test window.
+    final long maxMemory = 
ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax();
+    final long memoryLimit = (long) (maxMemory * 0.8);
     Thread thread = new Thread() {
       volatile boolean stopped = false;
 
       @Override
       public void run() {
         while (!stopped) {
+          if 
(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed() > 
memoryLimit) {
+            break;
+          }
           // keep triggering chunk retirement
           mslab.copyCellInto(cellToCopyInto);
         }

Reply via email to