You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by "eric6iese (via GitHub)" <gi...@apache.org> on 2025/06/13 07:28:34 UTC

[PR] CXF-9146 ThreadLocalClientState internally now uses a ThreadLocal [cxf]

eric6iese opened a new pull request, #2461:
URL: https://github.com/apache/cxf/pull/2461

   …instead of a WeakHashMap when timeToKeepState. This fixes a memory leak which occurs when the Thread is referenced within the ClientState to which the Thread points in the WeakHashMap. This scenario happens often, something with the new HttpClientConduit which internally might use a PipedInputStream referencing said thrad.
   
   I also added test to both check that the new implementation does not change the obversable behavior and a ruther blunt test which causes an OOME with the current implementation, but not with the new one. The tests are far from perfect because they use passive sleep statements instead of something like awaitility, but I did not want to write custom wait loops or integrate external libraries.


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CXF-9146 ThreadLocalClientState internally now uses a ThreadLocal [cxf]

Posted by "eric6iese (via GitHub)" <gi...@apache.org>.
eric6iese commented on PR #2461:
URL: https://github.com/apache/cxf/pull/2461#issuecomment-2972497176

   Sadly, the solution does not work as expected: While it fixes the MemoryLeak with dead threads, it opens up a completely different memory leak when creating many short-lived instances from the same thread. 
   
   This, and the fact that there are even more WeakHashMaps of Threads in the SOAP-Client convinces me that the fix should instead be within the HttpClientHTTPConduit by removing the PipedStreams as soon as they are closed.


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CXF-9146 ThreadLocalClientState internally now uses a ThreadLocal [cxf]

Posted by "eric6iese (via GitHub)" <gi...@apache.org>.
eric6iese closed pull request #2461: CXF-9146 ThreadLocalClientState internally now uses a ThreadLocal
URL: https://github.com/apache/cxf/pull/2461


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CXF-9146 ThreadLocalClientState internally now uses a ThreadLocal [cxf]

Posted by "eric6iese (via GitHub)" <gi...@apache.org>.
eric6iese commented on PR #2461:
URL: https://github.com/apache/cxf/pull/2461#issuecomment-2977395129

   Closed, I will create a simpler PR with a more appropiate solution.


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org