xiejiajun commented on pull request #4119:
URL: https://github.com/apache/zeppelin/pull/4119#issuecomment-841641694


   > Not sure whether this is the root cause. According the javadoc of 
Context#close, it looks like even close is not called, it would be released.
   > 
   > ```
   >     /**
   >      * Closes this context.
   >      * This method releases this context's resources immediately, instead 
of
   >      * waiting for them to be released automatically by the garbage 
collector.
   >      *
   >      * <p> This method is idempotent:  invoking it on a context that has
   >      * already been closed has no effect.  Invoking any other method
   >      * on a closed context is not allowed, and results in undefined 
behaviour.
   >      *
   >      * @throws  NamingException if a naming exception is encountered
   >      */
   >     public void close() throws NamingException;
   > ```
   
   @zjffdu 
   The close method of LdapCtx will call the close method of LdapClient to 
return the connection to the connection pool. If we rely on the GC mechanism, 
although the Context object can be cleared,  the connection will not be 
returned normally. And a new connection will be created the next time we try to 
obtain a connection, which will cause connection leakage.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to