You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Leonardo Uribe <lu...@gmail.com> on 2016/09/01 13:24:43 UTC

Re: MyFaces 2.2.10 and Red Hat EAP 6.4.8 issue with memory leak of @viewscope

Hi

I'm cc to MyFaces users list, because these issues should be discussed
there.

It is a known issue, in resume it is JBossWeb fault, because that map
should be a WeakHashMap but synchronized, to ensure the instances are
discarded when the beans are serialised into session (in that case destroy
will not be called). The fix should be done in WebInjectionContainer, but
set org.apache.myfaces.SERIALIZE_STATE_IN_SESSION
<https://myfaces.apache.org/core20/myfaces-impl/webconfig.html#org_apache_myfaces_SERIALIZE_STATE_IN_SESSION>
to
false could help to mitigate a bit the leak.

There is an issue related to @PreDestroy and view scope in

https://issues.apache.org/jira/browse/MYFACES-4047

but I guess it won't help in your case, because the leak is caused by the
map itself.

regards,

Leonardo Uribe


2016-09-01 3:34 GMT-05:00 Thony Lundin <th...@tieto.com>:

> Hi Leonardo,
>
> writing you since you are MyFaces core project lead and want to ask about
> a possible issue in MyFaces 2.2.10 regarding not released viewscope beans.
>
> I have seen on Internet that there was multiple such issues reported for
> mojarra&myfaces in the past and Red Hat did some fix in their EAP 6.1.1 or
> so (in the mojarra module) to solve this issue.
>
> Problem for us is that we came from using tomcat and went on top of Red
> Hat EAP with JBossWeb and wanted to keep MyFaces (since it provided us with
> best performance and configuration options) but we are hit by this memory
> leak that somehow MyFaces and JBossWeb do not interact properly when a
> viewscope bean is getting invalidated. Problem is that when viewscope is
> invalidated the reference to our controllers are still kept in JBossWeb
> WebInjectionContainer and it is kept there forever, even if session expires?
>
> org.jboss.as.web.deployment.WebInjectionContainer @ 0xc45318d8 | 32 |
> 649,769,928 | 73.07% |- org.jboss.as.web.deployment.ConcurrentReferenceHashMap
> @ 0xc4532518 | 48 | 649,766,792 | 73.07% | '- org.jboss.as.web.deployment.
> ConcurrentReferenceHashMap$Segment[4] @ 0xc4532548| 32 | 649,766,744 |
> 73.07% | |- org.jboss.as.web.deployment.ConcurrentReferenceHashMap$Segment
> @ 0xc4532568| 56 | 187,909,296 | 21.13%
>
> Red Hat will not do anything due to that they only support mojarra so I am
> asking if this is something known on MyFaces project and if there is
> something that could be done on MyFaces core side about it (just asking
> since same problem for JBossWeb&mojarra was solved somehow on mojarra side)
> or if you think this is a JBossWeb fault?
>
> Grateful for any information you can share on this issue.
>
> Best Regards,
> Thony
>

Re: MyFaces 2.2.10 and Red Hat EAP 6.4.8 issue with memory leak of @viewscope

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
The main point is: if I have my very own Object I put into the Session myself. And for whatever reason I create an InjectionTarget and apply CDI Injection into it. Then this _must not leak_. The specs (CDI & Servlet) are very clear about that.


LieGrue,
strub


On Monday, 5 September 2016, 8:18, Thony Lundin <th...@tieto.com> wrote:
>Hi,
>
>
>thankful for every effort, we have solved it temporarily by having a sessionscope bean that keeps tracks of the viewscope beans for each user session. When session expires the sessionscope bean is properly called and we cleanup the references ourselves but this is a "dirty" fix since viewscopes lives now as long as session (which it should not do in many cases) and in fact we should not have to care about cleaning references ourselves :)
>
>
>Red Hat did some fix in EAP 6.1.1 (I believe) related to leaking viewscopes but for some reason I think that fix was done on mojarra side, nothing was changed in JBossWeb (as far as I know).
>
>
>Regards,
>Thony 
>
>
>On 5 September 2016 at 08:02, Mark Struberg <st...@yahoo.de> wrote:
>
>Having glanced over the jboss code, I suspect they will have mem leaks with Mojarra as well. Maybe that helps. I know a few people from JBoss, will try to ping one of them.
>>
>>LieGrue,
>>Strub
>>
>>> Am 01.09.2016 um 15:24 schrieb Leonardo Uribe <lu...@gmail.com>:
>>>
>>> Hi
>>>
>>> I'm cc to MyFaces users list, because these issues should be discussed
>>> there.
>>>
>>> It is a known issue, in resume it is JBossWeb fault, because that map
>>> should be a WeakHashMap but synchronized, to ensure the instances are
>>> discarded when the beans are serialised into session (in that case destroy
>>> will not be called). The fix should be done in WebInjectionContainer, but
>>> set org.apache.myfaces.SERIALIZE_ STATE_IN_SESSION
>>> <https://myfaces.apache.org/ core20/myfaces-impl/webconfig. html#org_apache_myfaces_ SERIALIZE_STATE_IN_SESSION>
>>> to
>>> false could help to mitigate a bit the leak.
>>>
>>> There is an issue related to @PreDestroy and view scope in
>>>
>>> https://issues.apache.org/ jira/browse/MYFACES-4047
>>>
>>> but I guess it won't help in your case, because the leak is caused by the
>>> map itself.
>>>
>>> regards,
>>>
>>> Leonardo Uribe
>>>
>>>
>>> 2016-09-01 3:34 GMT-05:00 Thony Lundin <th...@tieto.com>:
>>>
>>>> Hi Leonardo,
>>>>
>>>> writing you since you are MyFaces core project lead and want to ask about
>>>> a possible issue in MyFaces 2.2.10 regarding not released viewscope beans.
>>>>
>>>> I have seen on Internet that there was multiple such issues reported for
>>>> mojarra&myfaces in the past and Red Hat did some fix in their EAP 6.1.1 or
>>>> so (in the mojarra module) to solve this issue.
>>>>
>>>> Problem for us is that we came from using tomcat and went on top of Red
>>>> Hat EAP with JBossWeb and wanted to keep MyFaces (since it provided us with
>>>> best performance and configuration options) but we are hit by this memory
>>>> leak that somehow MyFaces and JBossWeb do not interact properly when a
>>>> viewscope bean is getting invalidated. Problem is that when viewscope is
>>>> invalidated the reference to our controllers are still kept in JBossWeb
>>>> WebInjectionContainer and it is kept there forever, even if session expires?
>>>>
>>>> org.jboss.as.web.deployment. WebInjectionContainer @ 0xc45318d8 | 32 |
>>>> 649,769,928 | 73.07% |- org.jboss.as.web.deployment. ConcurrentReferenceHashMap
>>>> @ 0xc4532518 | 48 | 649,766,792 | 73.07% | '- org.jboss.as.web.deployment.
>>>> ConcurrentReferenceHashMap$ Segment[4] @ 0xc4532548| 32 | 649,766,744 |
>>>> 73.07% | |- org.jboss.as.web.deployment. ConcurrentReferenceHashMap$ Segment
>>>> @ 0xc4532568| 56 | 187,909,296 | 21.13%
>>>>
>>>> Red Hat will not do anything due to that they only support mojarra so I am
>>>> asking if this is something known on MyFaces project and if there is
>>>> something that could be done on MyFaces core side about it (just asking
>>>> since same problem for JBossWeb&mojarra was solved somehow on mojarra side)
>>>> or if you think this is a JBossWeb fault?
>>>>
>>>> Grateful for any information you can share on this issue.
>>>>
>>>> Best Regards,
>>>> Thony
>>>>
>>
>>
>
>
>

Re: MyFaces 2.2.10 and Red Hat EAP 6.4.8 issue with memory leak of @viewscope

Posted by Mark Struberg <st...@yahoo.de.INVALID>.
Having glanced over the jboss code, I suspect they will have mem leaks with Mojarra as well. Maybe that helps. I know a few people from JBoss, will try to ping one of them.

LieGrue,
Strub

> Am 01.09.2016 um 15:24 schrieb Leonardo Uribe <lu...@gmail.com>:
> 
> Hi
> 
> I'm cc to MyFaces users list, because these issues should be discussed
> there.
> 
> It is a known issue, in resume it is JBossWeb fault, because that map
> should be a WeakHashMap but synchronized, to ensure the instances are
> discarded when the beans are serialised into session (in that case destroy
> will not be called). The fix should be done in WebInjectionContainer, but
> set org.apache.myfaces.SERIALIZE_STATE_IN_SESSION
> <https://myfaces.apache.org/core20/myfaces-impl/webconfig.html#org_apache_myfaces_SERIALIZE_STATE_IN_SESSION>
> to
> false could help to mitigate a bit the leak.
> 
> There is an issue related to @PreDestroy and view scope in
> 
> https://issues.apache.org/jira/browse/MYFACES-4047
> 
> but I guess it won't help in your case, because the leak is caused by the
> map itself.
> 
> regards,
> 
> Leonardo Uribe
> 
> 
> 2016-09-01 3:34 GMT-05:00 Thony Lundin <th...@tieto.com>:
> 
>> Hi Leonardo,
>> 
>> writing you since you are MyFaces core project lead and want to ask about
>> a possible issue in MyFaces 2.2.10 regarding not released viewscope beans.
>> 
>> I have seen on Internet that there was multiple such issues reported for
>> mojarra&myfaces in the past and Red Hat did some fix in their EAP 6.1.1 or
>> so (in the mojarra module) to solve this issue.
>> 
>> Problem for us is that we came from using tomcat and went on top of Red
>> Hat EAP with JBossWeb and wanted to keep MyFaces (since it provided us with
>> best performance and configuration options) but we are hit by this memory
>> leak that somehow MyFaces and JBossWeb do not interact properly when a
>> viewscope bean is getting invalidated. Problem is that when viewscope is
>> invalidated the reference to our controllers are still kept in JBossWeb
>> WebInjectionContainer and it is kept there forever, even if session expires?
>> 
>> org.jboss.as.web.deployment.WebInjectionContainer @ 0xc45318d8 | 32 |
>> 649,769,928 | 73.07% |- org.jboss.as.web.deployment.ConcurrentReferenceHashMap
>> @ 0xc4532518 | 48 | 649,766,792 | 73.07% | '- org.jboss.as.web.deployment.
>> ConcurrentReferenceHashMap$Segment[4] @ 0xc4532548| 32 | 649,766,744 |
>> 73.07% | |- org.jboss.as.web.deployment.ConcurrentReferenceHashMap$Segment
>> @ 0xc4532568| 56 | 187,909,296 | 21.13%
>> 
>> Red Hat will not do anything due to that they only support mojarra so I am
>> asking if this is something known on MyFaces project and if there is
>> something that could be done on MyFaces core side about it (just asking
>> since same problem for JBossWeb&mojarra was solved somehow on mojarra side)
>> or if you think this is a JBossWeb fault?
>> 
>> Grateful for any information you can share on this issue.
>> 
>> Best Regards,
>> Thony
>>