-
1. Re: Brwoser memory leaks when using a4j:poll
parki Jan 8, 2008 3:22 PM (in response to kshenes)Is there any more information on this - I'm embarking on a JSF implementation that must rely heavily on <a4j:poll> (or <a4j:push>) and a memory leak in this is gonna be a nightmare.
I'll do some testing, just wondering if anyone else can chime in with some experience here.
Many thanks.
parki... -
2. Re: Brwoser memory leaks when using a4j:poll
fmarwede Jan 8, 2008 3:43 PM (in response to kshenes)We had the same problem and add the following in the web.xml:
<context-param> <description>State saving method: "client" or "server" (= default) See JSF Specification 2.5.3</description> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>server</param-value> </context-param> <context-param> <description>Only applicable if state saving method is "server" (= default). Defines the amount (default = 20) of the latest views are stored in session.</description> <param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name> <param-value>10</param-value> </context-param>
I'm no expert on this topic and don't know if it's the only or best solution but in our context it worked. -
3. Re: Brwoser memory leaks when using a4j:poll
ilya_shaikovsky Jan 9, 2008 6:09 AM (in response to kshenes)For now we have numerous works about memory leaks in different components after prototype update. WE hope it'll be much better in nearest future.
-
4. Re: Brwoser memory leaks when using a4j:poll
kshenes Jan 9, 2008 11:45 AM (in response to kshenes)I added the <context-param> suggested in comment #3, firefox started @ 86,700 bytes. After 20 hours it was over 900,000 bytes. This is rather extreme for a page that contains undter 10 items that are refreshed.
I understand that some of this could be an issue in the browser, but someone needs to review the javascript to make sure there are no circular references between javascript objects and DOM objects. -
5. Re: Brwoser memory leaks when using a4j:poll
nbelaevski Jan 9, 2008 3:06 PM (in response to kshenes)I cannot see memory leaks using IE. What browser are you using?
-
6. Re: Brwoser memory leaks when using a4j:poll
kshenes Jan 10, 2008 12:58 PM (in response to kshenes)I retested with IE 7.0 and it did not leak.
Using Firefox version 2.0.0.11 it does leak. Looks like a browser issue.
Thanks for the suggestions and BTW I really like the product! -
7. Re: Brwoser memory leaks when using a4j:poll
nbelaevski Jan 10, 2008 9:30 PM (in response to kshenes)Got it, we'll work on the problem...
http://jira.jboss.com/jira/browse/RF-1884 -
8. Re: Brwoser memory leaks when using a4j:poll
pdpantages Sep 10, 2008 2:36 PM (in response to kshenes)Jboss 4.2.2.GA
Seam 2.0.1.GA
Richfaces 3.2.1.GA
Firefox 3
Hello Forum,
I have also a memory problem that I think is related to an a4j:poll.
I am using leak guage and see something like this.Leaked 10 out of 16 DOM Windows Leaked 0 out of 45 documents Leaked 6 out of 6 docshells Leaked content nodes within 40 out of 53 documents
Note FF is still up when I run leak gauge; when I shut down FF, all of
the above leaks are "cleared". Normally, this would indicate no leaks
for the session.
But I can see, if I leave my page up, the "Leaked content nodes"
bump up by 1 on each poll. E.g., the next poll would result in
"41 out of 54" etc. This continues on increasing indefinitely.
The other values stay the same. While this may not technically be a leak
according to leak guage criteria, (closing FF seems to clean it all up),
I think this indicates some problem with the poll.
I can see that the JIRA opened earlier in this thread has been kicked out to
a "Future" release.
In the meantime, has anyone found any workarounds for the leak?
I tried the context params mentioned earlier in the thread. No change.
I am willing to edit the richfaces source and rebuild it if that is
what it takes to fix it.
I would also consider converting the polls to a4j:push, if the latter
can be made to work without leaking. Has anyone resorted to this?
Any suggestions will be appreciated.
Thanks, PdP -
9. Re: Brwoser memory leaks when using a4j:poll
pdpantages Sep 10, 2008 8:55 PM (in response to kshenes)Jboss 4.2.2.GA
Seam 2.0.1.GA
Richfaces 3.2.1.GA
Firefox 3
Hello Forum,
After some experimenting, this problem appears to be due to the
use of the onsubmit attribute of the poller.
E.g., a typical poller I have uses onsubmit to cancel it
if a flag is set:<a4j:region renderRegionOnly="false"> <a4j:poll id="subnetTreePoller" action="#{login.checkLoggedin}" interval="#{activeAlarmsImpl.ajaxPollInterval}" enabled="true" onsubmit="getPollEnabled2();" status="pollingStatus" eventsQueue="ajaxQueue" reRender="#{activeAlarmsImpl.ajaxRenderList}"> </a4j:poll> </a4j:region>
If I remove the onsubmit from this poller, the
"Leaked content nodes" count no longer increases
when the poller runs.
getPollEnabled2() is a simple function that will
skip up to five polls if a counter is set. It does
not reference any DOM objects.function getPollEnabled2() { if ( __pollCount >= 0 ) { __pollCount--; return false; } }
Unfortunately, I need the functionality provided by onsubmit;
I use this to disable the poll when the operator opens a row
context menu. Otherwise the menu closes whenever the poll runs.
Any help will be appreciated....
Thanks, PdP -
10. Re: Brwoser memory leaks when using a4j:poll
ilya_shaikovsky Sep 11, 2008 7:03 AM (in response to kshenes)could you please check with 3.2.2 GA? If the problem exist - please fill the jira issue.
-
11. Re: Brwoser memory leaks when using a4j:poll
pdpantages Sep 13, 2008 2:24 AM (in response to kshenes)This behaviour does not change in 3.2.2.
https://jira.jboss.org/jira/browse/RF-4470
Thanks,
PdP -
12. Re: Brwoser memory leaks when using a4j:poll
nbelaevski Sep 16, 2008 8:08 PM (in response to kshenes)PdP,
I've switched off all add-ons but Leak Detector addon and tried to reproduce the problem using the following code:<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/suggestionbox" prefix="rich" %> <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %> <html> <head> <title></title> </head> <body> <f:view> <h:form> <a4j:outputPanel id="holder"> <div> <script type="text/javascript"> __pollCount = 5; function getPollEnabled2() { if ( __pollCount >= 0 ) { __pollCount--; return false; } } </script> </div> </a4j:outputPanel> <a4j:region renderRegionOnly="false"> <a4j:poll id="subnetTreePoller" interval="500" enabled="true" status="pollingStatus" eventsQueue="ajaxQueue" onsubmit="return getPollEnabled2();" reRender="holder"> </a4j:poll> </a4j:region> <a4j:status id="pollingStatus" startText="..start..." /> </h:form> </f:view> </body> </html>
Results from Leak Gauge log:Results of processing log nspr6.log : Summary: Leaked 0 out of 11 DOM Windows Leaked 0 out of 58 documents Leaked 0 out of 5 docshells Leaked content nodes in 0 out of 66 documents
So the question is: can you please check whether you get memory leaks with the posted code snippet? -
13. Re: Brwoser memory leaks when using a4j:poll
pdpantages Sep 16, 2008 8:23 PM (in response to kshenes)Hello nickbelaevski, OK, I will try it.
It looks like you closed FF before running leak guage ( as all values are 0 ).
This is what I see also. Try leaving FF up, poll running, and periodically check it.
You should see the "leaked content nodes" value increasing with each poll.
I don't know if you are using RedHat on you client. If so, you can also watch FF memory using ps (tcsh syntax):
while 1
sleep 4
ps -p <FIREFOX-PID> -o rss,vsize --no-heading >> mem.txt
end
There must be a windows equivalent for this....
You can tail or look at mem.txt and should see rss in particular, increasing.
With a bit of massaging the data can be plotted with xgraph.
Fyi, I also see a leak on FF2 (2.0.0.16) and IE7.
PdP -
14. Re: Brwoser memory leaks when using a4j:poll
nbelaevski Sep 16, 2008 9:01 PM (in response to kshenes)PdP,
I see slight increase in values of leak gauge trying to process log from live browser and it doesn't happen for every request. Not sure whether leak gauge is designed to work correctly in that way.
I'll left the browser work overnight and check memory consumption in several hours.