logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From René Zanner (JIRA) <j...@apache.org>
Subject [jira] [Updated] (LOG4J2-1196) MongoDbConnection does not close MongoClient
Date Tue, 10 Nov 2015 14:42:11 GMT

     [ https://issues.apache.org/jira/browse/LOG4J2-1196?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

René Zanner updated LOG4J2-1196:
    Affects Version/s: 2.3

> MongoDbConnection does not close MongoClient
> --------------------------------------------
>                 Key: LOG4J2-1196
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1196
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.2, 2.3, 2.4, 2.4.1
>            Reporter: René Zanner
>            Priority: Critical
> When shutting down Log4J, e. g. during undeployment of a web application, the MongoClient
opened by the MongoDbProvider must be closed by the MongoDbConnection.close() method. Otherwise
the thread pool opened by the MongoClient will not get shutdown, since the MongoClient itself
won't get closed.
> The quick fix is to remove the comments {code}        // there's no need to call this.mongo.close()
since that literally closes the connection
>         // MongoDBClient uses internal connection pooling
>         // for more details, see LOG4J2-591
> {code} from the "close()" method of MongoDbConnection, as it's very misleading and, actually,
> Instead, you really have to call {code}this.mongo.close(){code} here, because the "close()"
method of the MongoDbConnection is called *only* when shutting down NoSqlDatabaseManager using
> My suggestion is to implement a similar strategy as used in the CouchDbConnection - using
an AtomicBoolean flag to check whether "close()" has already been called. 
> This way the code also works for the new MongoDB Java driver 3.x API.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org

View raw message