commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Thomas (JIRA)" <>
Subject [jira] [Commented] (POOL-316) Evictor periodically throws NullPointerExceptions
Date Wed, 02 Nov 2016 15:44:58 GMT


Mark Thomas commented on POOL-316:

Line 781 is:
evict = evictionPolicy.evict(evictionConfig, underTest,
Either evictionPolicy or idleObjects must be null to trigger the NPE.
It can't be idleObjects since a) it is non-null and final and b) it is used earlier in the
method at line 752 and would trigger an NPE there it it was null.
Therefore it must be evictionPolicy. There does appear a way for that to be null without an
error being generated. If the evictionPolicyClassName is set to a valid class that does not
implement EvictionPolicy then evictionPolicy will be null. The code expects evictionPolicy
to be non-null so we need to handle this error rather than ignore it.

The above doesn't appear to explain why the OP is seeing an NPE. A test case remains desirable.

> Evictor periodically throws NullPointerExceptions
> -------------------------------------------------
>                 Key: POOL-316
>                 URL:
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 2.4.2
>            Reporter: Caleb Cittadino
> When the logging level is set to WARN or INFO we see the following NPE peridically:
> {code}
> [2016-10-20 13:26:38,646 | WARN  | org.apache.commons.dbcp2.BasicDataSource] An internal
object pool swallowed an Exception.
> java.lang.Exception: java.lang.NullPointerException
>        at org.apache.commons.pool2.impl.GenericObjectPool.evict(
>        at org.apache.commons.pool2.impl.BaseGenericObjectPool$
>        at java.util.TimerThread.mainLoop(Unknown Source) [na:1.8.0_25]
>        at Source) [na:1.8.0_25]
> Caused by: java.lang.NullPointerException: null
>        at org.apache.commons.pool2.impl.GenericObjectPool.evict(
>        ... 3 common frames omitted
> {code}

This message was sent by Atlassian JIRA

View raw message