Aryan Ganjoo created POOL-432:
---------------------------------

             Summary: ResilientPooledObjectFactory monitor dies when recovery 
has no adder
                 Key: POOL-432
                 URL: https://issues.apache.org/jira/browse/POOL-432
             Project: Commons Pool
          Issue Type: Bug
            Reporter: Aryan Ganjoo


When ResilientPooledObjectFactory observes a factory failure while the pool has 
no waiting borrowers, it marks the factory down but does not start an adder 
thread. After the delegate recovers and successful additions move the failure 
out of the recent-failure log, runChecks() calls adder.kill() even though adder 
is null. The resulting NullPointerException terminates the monitor thread, so a 
later outage is no longer detected.

Reproduction on current Commons Pool master 
(0d91a3efb5f1530e5fcba1a15b9577b618950547):
1. Start a ResilientPooledObjectFactory monitor with a delegate that can fail 
and recover, and no waiting borrowers.
2. Make the delegate fail; pool.addObject() throws and the factory is marked 
down. No adder starts.
3. Recover the delegate and add enough objects to move the earlier failure out 
of the log.
4. Observe the monitor-thread NullPointerException during recovery. Make the 
delegate fail again and add another object. The second outage is not detected 
because the monitor stopped.

Expected: recovery with no adder should not terminate the monitor; subsequent 
outages should still be detected.

A focused regression was reproduced failing against the unmodified base and 
passing with a local guard around adder.kill(). The patched test also passed 20 
consecutive local runs. A prior full local Maven verify passed; hosted CI has 
not run and no PR is open for this issue yet.

Prepared with AI assistance.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to