Pavel Kostelnik created HTTPCLIENT-2391:
-------------------------------------------

             Summary: Bug in closing AbstractHttpAsyncClientBase causing 
long-lived classloaders
                 Key: HTTPCLIENT-2391
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2391
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient (async)
    Affects Versions: 5.5, 5.6-alpha1
            Reporter: Pavel Kostelnik
         Attachments: bugClient.png

We have identified a bug in the closing mechanism of the executor service for 
{{{}AbstractHttpAsyncClientBase{}}}. The executor service is created as a 
single-thread executor, specifically an 
{{{}AutoShutdownDelegatedExecutorService{}}}. This class creates a phantom 
reference that is cleanable to the executor service it delegates to.
h4. *Issue Details:*
 * The {{AutoShutdownDelegatedExecutorService}} correctly calls the 
{{shutdownNow()}} method on the underlying executor service.
 * However, the phantom reference is never dereferenced and remains held 
internally.
 * When used with dynamic class loading, this results in a classloader hook 
that remains active, leading to long-lived classloaders that block non-heap 
memory.

h4. *Proposed Solution:*

*Call shutdown() after shutdownNow() -* Implement logic to ensure that the 
phantom reference is properly dereferenced
h4. *Benefits:*
 * Fixing this bug will prevent classloader hooks from hanging and ensure that 
non-heap memory is not blocked by long-lived classloaders.

Implementing this change will significantly enhance the resource management and 
reliability of the executor service in our application.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to