开发者

setInterval jsf2.0 glassfish v3 and memory Leaks

guys i'm new and i'm not english. I have a problem with using js setInterval that simulate a user click, every X seconds, on submit button. In the page there is only one h:form and h:commandButton. I use a profiler and i see that the java.util.HashMap increase continuosly it's size. After some hours the used heap size is growed a lot respect the start point.

Please help me, this problem make me crazy.

This is the code:

<?xml version = "1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">
    <h:head>
        <script type="text/javascript">
            var timeoutId = window.setInterval( "userClick()" , 1000 );
        </script>
    </h:head>
    <h:body>
    <h:panelGroup id="testo">test</h:panelGroup>
    <h:form prependId="false" >
        <h:commandButton id="buttonId"
                         action="null"
                         value="Invia">
            <f:ajax event="click" execute="@form" render=":testo"/>
        </h:commandButton>
    </h:form>
    <script type="text/javascript">
    function userClick()
    {
        document.getElementById('buttonId').click();
    }
    </script>
    </h:body>
</html>

Update: After 1 days the application crash again. Now I have used only the setIn开发者_运维知识库terval but i have the heapDump generated by glassfish this is the screenshot but i'm unable to post it because my reputation is too low. however java.lang.Object[] consume 20% of heap, java.util.HashMap$Entry[]18% and HashMap 10% Any idea?

Update: Hi, guys i have solved my problem and have found a bug in CDI dependency/injection. I have solved my problem changing the Annotation @Named with @ManagedBean and this solve my problem. In the example i have omitted the code because i think that CDI haven't bug. Obviously the Bean annotated with @Named have request Scoped while the ApplicationScoped Bean doesn't produce the bug. I'm relatively new with CDI, so where i must report the bug?


After some hours the used heap size is growed a lot respect the start point.

Ok. But what memory usage do you get after garbage collection (GC)? I suggest turning on GC logging (-Xloggc:file.log) and maybe post some graph of the results here. Also make sure you're using a up to date version of GlassFish (3.0.1).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜