You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flex.apache.org by "Robert Hunt (JIRA)" <ji...@apache.org> on 2015/06/11 13:08:01 UTC

[jira] [Commented] (FLEX-34648) [BLAZEDS]Memory Leak occurred in AsyncMessage when sending alot of

    [ https://issues.apache.org/jira/browse/FLEX-34648?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14581823#comment-14581823 ] 

Robert Hunt commented on FLEX-34648:
------------------------------------

I'm not sure if this is the same issue but we discovered a memory leak in our application related to a huge number of AsyncMessages being accumulated over time. We identied the issue in production by enabling "heap dump on crash" (in Tomcat) and then inspecting the heap dump using a profiler. We were later able to spot the issue as it was hapenning when we knew where to look.

What we found was that FlexSessions were accumulating a number of invalidated FlexClients. These FlexClients had outboundQueues full of undelivered AsyncMessages. Once a FlexClient is invalidated it no longer accepts messages into it's queue but it can take a few minutes for it to become invalidated (in our configuration) which meant they sometimes accumulated a fair amount of messages before becoming invalidated.

You'd expect invalidated FlexClients to be garbage collected but we found they were not, this was due to a strong reference being held in this bit of code:

https://github.com/apache/flex-blazeds/blob/master/modules/core/src/flex/messaging/endpoints/BaseStreamingHTTPEndpoint.java#L1105

Once it drops into the handleFlexClientStreamingOpenRequest method it ends up in a "wait-notify loop" and due to the strong reference to the FlexClients via the collection they can't be marked for garbage collection.

Our fix involves subclassing BaseStreamingHTTPEndpoint and overidding the serviceStreamingRequest method. We inserted the statement "flexClients.clear();" after this line: https://github.com/apache/flex-blazeds/blob/master/modules/core/src/flex/messaging/endpoints/BaseStreamingHTTPEndpoint.java#L1115

> [BLAZEDS]Memory Leak occurred in AsyncMessage when sending alot of 
> -------------------------------------------------------------------
>
>                 Key: FLEX-34648
>                 URL: https://issues.apache.org/jira/browse/FLEX-34648
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: BlazeDS
>    Affects Versions: BlazeDS 4.7
>            Reporter: ibrahem.shawky@gmail.com
>            Priority: Critical
>
> a memory leak occurred when sending alot of AsyncMessage through BLAZEDS in a real time systems which is heavilly using messaging however we are increasing the jvm heap size  to 4 GB 80% of the size is occupied by AsyncMessage objects this is very clear from the generated heap dump.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)