You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Julian Sedding (JIRA)" <ji...@apache.org> on 2015/11/26 12:02:11 UTC
[jira] [Resolved] (SLING-4676) Clean up threads or refresh threads
when put back into the pool
[ https://issues.apache.org/jira/browse/SLING-4676?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Sedding resolved SLING-4676.
-----------------------------------
Resolution: Fixed
Assignee: Julian Sedding
Thank you for your comments [~cziegeler].
I have completed the implementation and committed at [r1716601|https://svn.apache.org/r1716601].
- I changed the key in the map to Long as suggested
- I unregister the uncaught exception handler in the custom uncaught exception handler, please check if that is in line with your suggestion
The default {{maxThreadAge}} is 5min. I had considered setting it to {{-1}} (never expire) for backwards compatibility, but decided that e.g. o.a.s.commons.event would then need to be changed to benefit from this change.
> Clean up threads or refresh threads when put back into the pool
> ---------------------------------------------------------------
>
> Key: SLING-4676
> URL: https://issues.apache.org/jira/browse/SLING-4676
> Project: Sling
> Issue Type: Improvement
> Components: Commons
> Reporter: Carsten Ziegeler
> Assignee: Julian Sedding
> Fix For: Commons Threads 3.2.2
>
> Attachments: SLING-4676-jsedding-1.patch, sling-4676-provisional.patch
>
>
> A thread from the pool might use thread locals which are - for whatever reason - not cleaned up, when the thread is put back into the pool.
> This can lead to memory leaks.
> We should protect against this.
> Unfortunately there is no official API to clean up thread locals. There are solutions out there using reflection.
> Another option is to simply discard the thread object after some time of usage and use a fresh one. This needs to include thread objects staying in the pool for a long time
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)