You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Pascal Schumacher (JIRA)" <ji...@apache.org> on 2018/05/07 18:47:00 UTC
[jira] [Resolved] (DBCP-476) AbandonedTrace.getTrace() contains
race condition
[ https://issues.apache.org/jira/browse/DBCP-476?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Schumacher resolved DBCP-476.
------------------------------------
Resolution: Fixed
Assignee: Pascal Schumacher
Fix Version/s: 2.3.0
> AbandonedTrace.getTrace() contains race condition
> -------------------------------------------------
>
> Key: DBCP-476
> URL: https://issues.apache.org/jira/browse/DBCP-476
> Project: Commons DBCP
> Issue Type: Bug
> Reporter: Richard Cordova
> Assignee: Pascal Schumacher
> Priority: Minor
> Fix For: 2.3.0
>
>
> The clean up code in AbandonedTrace is subject to the reference being cleared in between the condition being checked and the referent being added to the result.
> {code}
> while (iter.hasNext()) {
> WeakReference<AbandonedTrace> ref = iter.next();
> if (ref.get() == null) {
> // Clean-up since we are here anyway
> iter.remove();
> } else {
> result.add(ref.get());
> }
> }
> {code}
> This can surface as a NullPointerException, e.g.
> {noformat}
> Caused by: java.lang.NullPointerException
> at org.apache.tomcat.dbcp.dbcp2.DelegatingStatement.close(DelegatingStatement.java:149)
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)