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

psteitz pushed a commit to branch POOL_2_X
in repository https://gitbox.apache.org/repos/asf/commons-pool.git


The following commit(s) were added to refs/heads/POOL_2_X by this push:
     new 104c7b84 JIRA: POOL-290. Prevent infinite loop potential in 
TestSoftRefOutOfMemory.
104c7b84 is described below

commit 104c7b84059c6c6b8d171158c8906e0b8167fc1b
Author: Phil Steitz <phil.ste...@gmail.com>
AuthorDate: Fri May 23 17:20:36 2025 -0700

    JIRA: POOL-290. Prevent infinite loop potential in TestSoftRefOutOfMemory.
---
 src/changes/changes.xml                                                | 1 +
 .../java/org/apache/commons/pool2/impl/TestSoftRefOutOfMemory.java     | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 5895e8c8..11346422 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -47,6 +47,7 @@ The <action> type attribute can be add,update,fix,remove.
   <body>
   <release version="2.12.2" date="YYYY-MM-DD" description="This is a feature 
and maintenance release. Java 8 or later is required.">
     <!-- FIX -->
+    <action type="fix" issue="POOL-290" dev="psteitz" due-to="Serge 
Angelov">TestSoftRefOutOfMemory (unit test) can loop infinitely on 
failure.</action>
     <action type="fix" issue="POOL-419" dev="psteitz" due-to="Raju Gupta, Phil 
Steitz">GenericObjectPool counters and object collections can be corrupted when 
returnObject and invalidate are invoked concurrently by client threads on the 
same pooled object.</action>
     <action type="fix" issue="POOL-421" dev="psteitz" due-to="Phil 
Steitz">GenericObjectPool addObject should return immediately when there is no 
capacity to add.</action>
     <action type="fix" issue="POOL-420" dev="psteitz" due-to="Phil Steitz">The 
maximum wait time for GenericKeyedObjectPool.borrowObject(*) may exceed 
configured maximum wait time. This is the same issue as POOL-418, but for GKOP.
diff --git 
a/src/test/java/org/apache/commons/pool2/impl/TestSoftRefOutOfMemory.java 
b/src/test/java/org/apache/commons/pool2/impl/TestSoftRefOutOfMemory.java
index 894f2325..64e58642 100644
--- a/src/test/java/org/apache/commons/pool2/impl/TestSoftRefOutOfMemory.java
+++ b/src/test/java/org/apache/commons/pool2/impl/TestSoftRefOutOfMemory.java
@@ -154,6 +154,7 @@ public class TestSoftRefOutOfMemory {
                 garbage.add(new byte[Math.min(1024 * 1024, (int) freeMemory / 
2)]);
             } catch (final OutOfMemoryError oome) {
                 System.gc();
+                assertEquals(0, pool.getNumIdle());
             }
             System.gc();
         }
@@ -194,6 +195,7 @@ public class TestSoftRefOutOfMemory {
                 garbage.add(new byte[Math.min(1024 * 1024, (int) freeMemory / 
2)]);
             } catch (final OutOfMemoryError oome) {
                 System.gc();
+                assertEquals(0, pool.getNumIdle());
             }
             System.gc();
         }
@@ -263,6 +265,7 @@ public class TestSoftRefOutOfMemory {
                 garbage.add(new byte[Math.min(1024 * 1024, (int) freeMemory / 
2)]);
             } catch (final OutOfMemoryError oome) {
                 System.gc();
+                assertEquals(0, pool.getNumIdle());
             }
             System.gc();
         }

Reply via email to