[jira] [Commented] (SLING-4676) Clean up threads or refresh threads when put back into the pool

2015-11-25 Thread Carsten Ziegeler (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15026675#comment-15026675
 ] 

Carsten Ziegeler commented on SLING-4676:
-

[~jsedding] Thanks for the patch, it looks basically ok to me. I would change 
two minor things:
- instead of using the Thread as the key in the map, the thread id (Long) could 
be used.
- I think it's safer to unset the uncaught exception handler after execution. 
This way no reference from the thread to the thread pool bundle is lying around


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


[jira] [Commented] (SLING-4676) Clean up threads or refresh threads when put back into the pool

2015-11-18 Thread Julian Sedding (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15011106#comment-15011106
 ] 

Julian Sedding commented on SLING-4676:
---

Ping [~cziegeler], I would really appreciate if you could take a look soon. 
Thanks a lot!

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


[jira] [Commented] (SLING-4676) Clean up threads or refresh threads when put back into the pool

2015-08-18 Thread Carsten Ziegeler (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14700859#comment-14700859
 ] 

Carsten Ziegeler commented on SLING-4676:
-

[~baedke] I think a test verifying this would be great, but yes my understand 
is that this should be sufficient (though I might be wrong)

 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
 Fix For: Commons Threads 3.2.2

 Attachments: 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)


[jira] [Commented] (SLING-4676) Clean up threads or refresh threads when put back into the pool

2015-08-17 Thread Manfred Baedke (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14700283#comment-14700283
 ] 

Manfred Baedke commented on SLING-4676:
---

Hi Carsten,

The keepalive time doesn't restrict the total life time of a thread, it just 
allows for removing threads that have been idle for some time - maybe that's 
sufficient?

 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
 Fix For: Commons Threads 3.2.2

 Attachments: 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)


[jira] [Commented] (SLING-4676) Clean up threads or refresh threads when put back into the pool

2015-08-14 Thread Carsten Ziegeler (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14697315#comment-14697315
 ] 

Carsten Ziegeler commented on SLING-4676:
-

[~baedke] I'm confused :) Isn't your patch already doing all that is required? 
As far as i can tell setting allowCoreThreadTimeOut to true and settings the 
keep alive time should do it. Or do I overlook something?

 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
 Fix For: Commons Threads 3.2.2

 Attachments: 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)


[jira] [Commented] (SLING-4676) Clean up threads or refresh threads when put back into the pool

2015-08-12 Thread Carsten Ziegeler (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14694706#comment-14694706
 ] 

Carsten Ziegeler commented on SLING-4676:
-

[~baedke] Yes, a new interface is required, otherwise it would break existing 
clients.

 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
 Fix For: Commons Threads 3.2.2


 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)


[jira] [Commented] (SLING-4676) Clean up threads or refresh threads when put back into the pool

2015-08-12 Thread Manfred Baedke (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14693834#comment-14693834
 ] 

Manfred Baedke commented on SLING-4676:
---

[~cziegeler], I will have to introduce new parameters to the thread pool 
configuration, which would add new methods to the interface ThreadPoolConfig. 
What's the policy on that? Creating a new interface extending the old one? 

 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
 Fix For: Commons Threads 3.2.2


 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)


[jira] [Commented] (SLING-4676) Clean up threads or refresh threads when put back into the pool

2015-06-12 Thread Chetan Mehrotra (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14583090#comment-14583090
 ] 

Chetan Mehrotra commented on SLING-4676:


For reflection based (best effort basis) approach we make use of logic used in 
Tomcat [1]

[1] 
https://github.com/apache/tomcat/blob/6030b7ff6d600d95db3bd3f8794fc64432856e72/java/org/apache/catalina/loader/WebappClassLoaderBase.java#L2014

 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
 Fix For: Commons Threads 3.2.2


 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)


[jira] [Commented] (SLING-4676) Clean up threads or refresh threads when put back into the pool

2015-04-28 Thread Stefan Egli (JIRA)

[ 
https://issues.apache.org/jira/browse/SLING-4676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14517148#comment-14517148
 ] 

Stefan Egli commented on SLING-4676:


bq. 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
+1
Sounds like a good approach (which might also be more future-proof than 
reflection)

 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
 Fix For: Commons Threads 3.2.2


 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)