You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Tomas Jucius (JIRA)" <ta...@jakarta.apache.org> on 2005/06/20 11:32:18 UTC

[jira] Created: (TAPESTRY-346) Memory leak then reseting pages..

Memory leak then reseting pages.. 
----------------------------------

         Key: TAPESTRY-346
         URL: http://issues.apache.org/jira/browse/TAPESTRY-346
     Project: Tapestry
        Type: Bug
    Versions: 3.0.3    
 Environment: windows xp
    Reporter: Tomas Jucius
    Priority: Critical


Here what I have found.. I can't develop my project because of this..
Because it depends on this feature..

As we all know tapestry put all things into pool ant it retrieves it
when you request for page and etc...

My application sometimes need to reset this pool..

So I use reset service..

But after a lot of resets jvm memory becomes full, and I get
"java.lang.OutOfMemoryError"
So after each reset some object are not collected.. And some
references to objects are left.. I could't find where..

if in class AbstractEngine you comment these lines in clearCachedData  method

_pageSource.reset();
_pool.clear();

when memory usage stops growing bet pool is not cleared:)..
So I suppose what pool is buggy or something else.. couldn't figure..

TO SEE THIS BUG DEPLOY NEW APPLICATION WITH THESE FILES:

-----------------------------HomePage.java-------------------------------

mport java.io.IOException;
import java.util.Map;

import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.Tapestry;
import org.apache.tapestry.engine.IEngineService;
import org.apache.tapestry.html.BasePage;
import org.apache.tapestry.util.prop.PropertyFinder;

public class HomePage extends BasePage {
       public void beginResponse(IMarkupWriter writer, IRequestCycle cycle) {
               // TODO Auto-generated method stub
               System.out.println("redirect " +
cycle.getEngine().isResetServiceEnabled() + " " +
(Runtime.getRuntime().totalMemory()) );
               redirectToResetService(cycle);

               try {
                       Thread.sleep(200);
               }
               catch (InterruptedException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
               }
               super.beginResponse(writer, cycle);
       }

       public void redirectToResetService(IRequestCycle cycle) {
               IEngineService resetService =
cycle.getEngine().getService(Tapestry.RESET_SERVICE);

               try {
                       cycle.getRequestContext().redirect((resetService.getLink(cycle,
this, null).getURL()));
                       resetService = null;
               }
               catch (IOException e) {
                       e.printStackTrace();
               }
       }
}

------------------------------Home.page-----------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
 "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
 "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<!-- generated by Spindle, http://spindle.sourceforge.net -->

<page-specification class="HomePage">

</page-specification>

---------------------------Home.html------------------------------
<html>
<head>

</head>

<body>
  <div jwcid="@Insert" value="leak" />
</body>
</html>
OPEN YOUR APPLICATION WITH EXPLORER IT HAS NO REDIRECTION LIMIT..
AND YOU CAN SET MAX MEMORY PROPERTY TO: -Xmx3M


IF THEREIS NO ANY COMPONENT in page when it is not leaking (so I put
this insert)..
So maybe of component specifications it is leaking?

Used profiler.. I didn't see growing any tapestry object only
java.util.* classes..

Appreciate all your notes...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


[jira] Commented: (TAPESTRY-346) Memory leak then reseting pages..

Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-346?page=comments#action_12316355 ] 

Howard M. Lewis Ship commented on TAPESTRY-346:
-----------------------------------------------

Hm. I was wrong; from the 4.0 code base:

    public ILink getLink(IRequestCycle cycle, Object parameter)
    {
        if (parameter != null)
            throw new IllegalArgumentException(EngineMessages.serviceNoParameter(this));

        Map parameters = new HashMap();

        parameters.put(ServiceConstants.SERVICE, Tapestry.RESET_SERVICE);
        parameters.put(ServiceConstants.PAGE, cycle.getPage().getPageName());

        return _linkFactory.constructLink(cycle, parameters, true);
    }

So null is the expected value, and it uses whatever the active page is.

Your problem description is still insufficient; full of wild guesses and vague assertions.

> Memory leak then reseting pages..
> ---------------------------------
>
>          Key: TAPESTRY-346
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-346
>      Project: Tapestry
>         Type: Bug
>     Versions: 3.0.3
>  Environment: windows xp
>     Reporter: Tomas Jucius
>     Priority: Critical

>
> Here what I have found.. I can't develop my project because of this..
> Because it depends on this feature..
> As we all know tapestry put all things into pool ant it retrieves it
> when you request for page and etc...
> My application sometimes need to reset this pool..
> So I use reset service..
> But after a lot of resets jvm memory becomes full, and I get
> "java.lang.OutOfMemoryError"
> So after each reset some object are not collected.. And some
> references to objects are left.. I could't find where..
> if in class AbstractEngine you comment these lines in clearCachedData  method
> _pageSource.reset();
> _pool.clear();
> when memory usage stops growing bet pool is not cleared:)..
> So I suppose what pool is buggy or something else.. couldn't figure..
> TO SEE THIS BUG DEPLOY NEW APPLICATION WITH THESE FILES:
> -----------------------------HomePage.java-------------------------------
> mport java.io.IOException;
> import java.util.Map;
> import org.apache.tapestry.IMarkupWriter;
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.Tapestry;
> import org.apache.tapestry.engine.IEngineService;
> import org.apache.tapestry.html.BasePage;
> import org.apache.tapestry.util.prop.PropertyFinder;
> public class HomePage extends BasePage {
>        public void beginResponse(IMarkupWriter writer, IRequestCycle cycle) {
>                // TODO Auto-generated method stub
>                System.out.println("redirect " +
> cycle.getEngine().isResetServiceEnabled() + " " +
> (Runtime.getRuntime().totalMemory()) );
>                redirectToResetService(cycle);
>                try {
>                        Thread.sleep(200);
>                }
>                catch (InterruptedException e) {
>                        // TODO Auto-generated catch block
>                        e.printStackTrace();
>                }
>                super.beginResponse(writer, cycle);
>        }
>        public void redirectToResetService(IRequestCycle cycle) {
>                IEngineService resetService =
> cycle.getEngine().getService(Tapestry.RESET_SERVICE);
>                try {
>                        cycle.getRequestContext().redirect((resetService.getLink(cycle,
> this, null).getURL()));
>                        resetService = null;
>                }
>                catch (IOException e) {
>                        e.printStackTrace();
>                }
>        }
> }
> ------------------------------Home.page-----------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE page-specification PUBLIC
>  "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
>  "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
> <!-- generated by Spindle, http://spindle.sourceforge.net -->
> <page-specification class="HomePage">
> </page-specification>
> ---------------------------Home.html------------------------------
> <html>
> <head>
> </head>
> <body>
>   <div jwcid="@Insert" value="leak" />
> </body>
> </html>
> OPEN YOUR APPLICATION WITH EXPLORER IT HAS NO REDIRECTION LIMIT..
> AND YOU CAN SET MAX MEMORY PROPERTY TO: -Xmx3M
> IF THEREIS NO ANY COMPONENT in page when it is not leaking (so I put
> this insert)..
> So maybe of component specifications it is leaking?
> Used profiler.. I didn't see growing any tapestry object only
> java.util.* classes..
> Appreciate all your notes...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


[jira] Resolved: (TAPESTRY-346) Memory leak then reseting pages..

Posted by "Jesse Kuhnert (JIRA)" <ta...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/TAPESTRY-346?page=all ]
     
Jesse Kuhnert resolved TAPESTRY-346:
------------------------------------

    Resolution: Won't Fix

If there is a discernable patch or issue logged that someone could follow and do something about it will likely be fixed.

> Memory leak then reseting pages..
> ---------------------------------
>
>          Key: TAPESTRY-346
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-346
>      Project: Tapestry
>         Type: Bug
>     Versions: 3.0.3
>  Environment: windows xp
>     Reporter: Tomas Jucius
>     Priority: Critical

>
> Here what I have found.. I can't develop my project because of this..
> Because it depends on this feature..
> As we all know tapestry put all things into pool ant it retrieves it
> when you request for page and etc...
> My application sometimes need to reset this pool..
> So I use reset service..
> But after a lot of resets jvm memory becomes full, and I get
> "java.lang.OutOfMemoryError"
> So after each reset some object are not collected.. And some
> references to objects are left.. I could't find where..
> if in class AbstractEngine you comment these lines in clearCachedData  method
> _pageSource.reset();
> _pool.clear();
> when memory usage stops growing bet pool is not cleared:)..
> So I suppose what pool is buggy or something else.. couldn't figure..
> TO SEE THIS BUG DEPLOY NEW APPLICATION WITH THESE FILES:
> -----------------------------HomePage.java-------------------------------
> mport java.io.IOException;
> import java.util.Map;
> import org.apache.tapestry.IMarkupWriter;
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.Tapestry;
> import org.apache.tapestry.engine.IEngineService;
> import org.apache.tapestry.html.BasePage;
> import org.apache.tapestry.util.prop.PropertyFinder;
> public class HomePage extends BasePage {
>        public void beginResponse(IMarkupWriter writer, IRequestCycle cycle) {
>                // TODO Auto-generated method stub
>                System.out.println("redirect " +
> cycle.getEngine().isResetServiceEnabled() + " " +
> (Runtime.getRuntime().totalMemory()) );
>                redirectToResetService(cycle);
>                try {
>                        Thread.sleep(200);
>                }
>                catch (InterruptedException e) {
>                        // TODO Auto-generated catch block
>                        e.printStackTrace();
>                }
>                super.beginResponse(writer, cycle);
>        }
>        public void redirectToResetService(IRequestCycle cycle) {
>                IEngineService resetService =
> cycle.getEngine().getService(Tapestry.RESET_SERVICE);
>                try {
>                        cycle.getRequestContext().redirect((resetService.getLink(cycle,
> this, null).getURL()));
>                        resetService = null;
>                }
>                catch (IOException e) {
>                        e.printStackTrace();
>                }
>        }
> }
> ------------------------------Home.page-----------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE page-specification PUBLIC
>  "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
>  "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
> <!-- generated by Spindle, http://spindle.sourceforge.net -->
> <page-specification class="HomePage">
> </page-specification>
> ---------------------------Home.html------------------------------
> <html>
> <head>
> </head>
> <body>
>   <div jwcid="@Insert" value="leak" />
> </body>
> </html>
> OPEN YOUR APPLICATION WITH EXPLORER IT HAS NO REDIRECTION LIMIT..
> AND YOU CAN SET MAX MEMORY PROPERTY TO: -Xmx3M
> IF THEREIS NO ANY COMPONENT in page when it is not leaking (so I put
> this insert)..
> So maybe of component specifications it is leaking?
> Used profiler.. I didn't see growing any tapestry object only
> java.util.* classes..
> Appreciate all your notes...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


[jira] Commented: (TAPESTRY-346) Memory leak then reseting pages..

Posted by "Tony Sung (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-346?page=comments#action_12361583 ] 

Tony Sung commented on TAPESTRY-346:
------------------------------------

We also have the same problem on 4.0rc3. I suspect it's about building up of a lot of page classes over time when caching is disabled.

I believe that with caching disabled, everytime we load a page, a new page class is created. But my gc trace show that no class GC occurs throughout the whole application lifecycle, except when we reload the application tomcat 5.5.14 force discarding of all classes.

So it may be cause by the inability to GC old page classes in runtime, probably caused by singletons in the page class.

I've tried to look into the source code but failed. I somehow get lost in the "ComponentConstructorFactoryImpl". Can't figure out where and how Tapestry do the class enhancement.



> Memory leak then reseting pages..
> ---------------------------------
>
>          Key: TAPESTRY-346
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-346
>      Project: Tapestry
>         Type: Bug
>     Versions: 3.0.3
>  Environment: windows xp
>     Reporter: Tomas Jucius
>     Priority: Critical

>
> Here what I have found.. I can't develop my project because of this..
> Because it depends on this feature..
> As we all know tapestry put all things into pool ant it retrieves it
> when you request for page and etc...
> My application sometimes need to reset this pool..
> So I use reset service..
> But after a lot of resets jvm memory becomes full, and I get
> "java.lang.OutOfMemoryError"
> So after each reset some object are not collected.. And some
> references to objects are left.. I could't find where..
> if in class AbstractEngine you comment these lines in clearCachedData  method
> _pageSource.reset();
> _pool.clear();
> when memory usage stops growing bet pool is not cleared:)..
> So I suppose what pool is buggy or something else.. couldn't figure..
> TO SEE THIS BUG DEPLOY NEW APPLICATION WITH THESE FILES:
> -----------------------------HomePage.java-------------------------------
> mport java.io.IOException;
> import java.util.Map;
> import org.apache.tapestry.IMarkupWriter;
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.Tapestry;
> import org.apache.tapestry.engine.IEngineService;
> import org.apache.tapestry.html.BasePage;
> import org.apache.tapestry.util.prop.PropertyFinder;
> public class HomePage extends BasePage {
>        public void beginResponse(IMarkupWriter writer, IRequestCycle cycle) {
>                // TODO Auto-generated method stub
>                System.out.println("redirect " +
> cycle.getEngine().isResetServiceEnabled() + " " +
> (Runtime.getRuntime().totalMemory()) );
>                redirectToResetService(cycle);
>                try {
>                        Thread.sleep(200);
>                }
>                catch (InterruptedException e) {
>                        // TODO Auto-generated catch block
>                        e.printStackTrace();
>                }
>                super.beginResponse(writer, cycle);
>        }
>        public void redirectToResetService(IRequestCycle cycle) {
>                IEngineService resetService =
> cycle.getEngine().getService(Tapestry.RESET_SERVICE);
>                try {
>                        cycle.getRequestContext().redirect((resetService.getLink(cycle,
> this, null).getURL()));
>                        resetService = null;
>                }
>                catch (IOException e) {
>                        e.printStackTrace();
>                }
>        }
> }
> ------------------------------Home.page-----------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE page-specification PUBLIC
>  "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
>  "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
> <!-- generated by Spindle, http://spindle.sourceforge.net -->
> <page-specification class="HomePage">
> </page-specification>
> ---------------------------Home.html------------------------------
> <html>
> <head>
> </head>
> <body>
>   <div jwcid="@Insert" value="leak" />
> </body>
> </html>
> OPEN YOUR APPLICATION WITH EXPLORER IT HAS NO REDIRECTION LIMIT..
> AND YOU CAN SET MAX MEMORY PROPERTY TO: -Xmx3M
> IF THEREIS NO ANY COMPONENT in page when it is not leaking (so I put
> this insert)..
> So maybe of component specifications it is leaking?
> Used profiler.. I didn't see growing any tapestry object only
> java.util.* classes..
> Appreciate all your notes...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


[jira] Commented: (TAPESTRY-346) Memory leak then reseting pages..

Posted by "Howard M. Lewis Ship (JIRA)" <ta...@jakarta.apache.org>.
    [ http://issues.apache.org/jira/browse/TAPESTRY-346?page=comments#action_12316354 ] 

Howard M. Lewis Ship commented on TAPESTRY-346:
-----------------------------------------------

I suspect this is just how you are using the reset service:

             try {
                       cycle.getRequestContext().redirect((resetService.getLink(cycle,
this, null).getURL()));
                       resetService = null;


The last parameter to the reset service should be an array of objects; it should be a single object, the name of the page to display.

I'm not sure why this gets into any kind of loop in your code.

The OutOfMemory exception would be because of recursive stack .... do you do anything wierd in terms of exception reporting (such as returning to the home page).

Others do not see your issues of memory useage.  Tapestry memory useage "tops off" after all pages and components are parsed into memory.

> Memory leak then reseting pages..
> ---------------------------------
>
>          Key: TAPESTRY-346
>          URL: http://issues.apache.org/jira/browse/TAPESTRY-346
>      Project: Tapestry
>         Type: Bug
>     Versions: 3.0.3
>  Environment: windows xp
>     Reporter: Tomas Jucius
>     Priority: Critical

>
> Here what I have found.. I can't develop my project because of this..
> Because it depends on this feature..
> As we all know tapestry put all things into pool ant it retrieves it
> when you request for page and etc...
> My application sometimes need to reset this pool..
> So I use reset service..
> But after a lot of resets jvm memory becomes full, and I get
> "java.lang.OutOfMemoryError"
> So after each reset some object are not collected.. And some
> references to objects are left.. I could't find where..
> if in class AbstractEngine you comment these lines in clearCachedData  method
> _pageSource.reset();
> _pool.clear();
> when memory usage stops growing bet pool is not cleared:)..
> So I suppose what pool is buggy or something else.. couldn't figure..
> TO SEE THIS BUG DEPLOY NEW APPLICATION WITH THESE FILES:
> -----------------------------HomePage.java-------------------------------
> mport java.io.IOException;
> import java.util.Map;
> import org.apache.tapestry.IMarkupWriter;
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.Tapestry;
> import org.apache.tapestry.engine.IEngineService;
> import org.apache.tapestry.html.BasePage;
> import org.apache.tapestry.util.prop.PropertyFinder;
> public class HomePage extends BasePage {
>        public void beginResponse(IMarkupWriter writer, IRequestCycle cycle) {
>                // TODO Auto-generated method stub
>                System.out.println("redirect " +
> cycle.getEngine().isResetServiceEnabled() + " " +
> (Runtime.getRuntime().totalMemory()) );
>                redirectToResetService(cycle);
>                try {
>                        Thread.sleep(200);
>                }
>                catch (InterruptedException e) {
>                        // TODO Auto-generated catch block
>                        e.printStackTrace();
>                }
>                super.beginResponse(writer, cycle);
>        }
>        public void redirectToResetService(IRequestCycle cycle) {
>                IEngineService resetService =
> cycle.getEngine().getService(Tapestry.RESET_SERVICE);
>                try {
>                        cycle.getRequestContext().redirect((resetService.getLink(cycle,
> this, null).getURL()));
>                        resetService = null;
>                }
>                catch (IOException e) {
>                        e.printStackTrace();
>                }
>        }
> }
> ------------------------------Home.page-----------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE page-specification PUBLIC
>  "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
>  "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
> <!-- generated by Spindle, http://spindle.sourceforge.net -->
> <page-specification class="HomePage">
> </page-specification>
> ---------------------------Home.html------------------------------
> <html>
> <head>
> </head>
> <body>
>   <div jwcid="@Insert" value="leak" />
> </body>
> </html>
> OPEN YOUR APPLICATION WITH EXPLORER IT HAS NO REDIRECTION LIMIT..
> AND YOU CAN SET MAX MEMORY PROPERTY TO: -Xmx3M
> IF THEREIS NO ANY COMPONENT in page when it is not leaking (so I put
> this insert)..
> So maybe of component specifications it is leaking?
> Used profiler.. I didn't see growing any tapestry object only
> java.util.* classes..
> Appreciate all your notes...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org