[
https://issues.apache.org/jira/browse/WICKET-6633?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16755404#comment-16755404
]
Martin Grigorov commented on WICKET-6633:
-----------------------------------------
The problem is not related to CryptoMapper. The problem is session creation.
When using CryptoMapper Wicket uses by default KeyInSessionSunJceCryptFactory
to create an ICrypt instance and stores it in the web session for the user. See
org.apache.wicket.core.util.crypt.KeyInSessionSunJceCryptFactory#newCrypt - it
calls Session#bind() method.
Since you remove the cookies (and do not use jsessionid in the url) a new http
session is created for each request.
By default the session lifetime is 30 mins (you do not specify a custom one it
in web.xml!) so the number of sessions just grows and obviously 64M is not
enough for 100K sessions.
To verify I've made the following change to you code:
{code}
diff --git src/main/java/com/github/jvanheesch/wicket/HomePage.java
src/main/java/com/github/jvanheesch/wicket/HomePage.java
index 6c2bf87..fc2cb5f 100644
--- src/main/java/com/github/jvanheesch/wicket/HomePage.java
+++ src/main/java/com/github/jvanheesch/wicket/HomePage.java
@@ -14,6 +14,8 @@ public class HomePage extends WebPage {
super.onInitialize();
this.add(new Label("styledLabel", "styledLabel"));
+
+ getSession().bind();
+ //
((javax.servlet.http.HttpServletRequest)getRequest().getContainerRequest()).getSession().setMaxInactiveInterval(1);
}
@Override
diff --git src/main/java/com/github/jvanheesch/wicket/WicketApplication.java
src/main/java/com/github/jvanheesch/wicket/WicketApplication.java
index 420061d..76e665e 100644
--- src/main/java/com/github/jvanheesch/wicket/WicketApplication.java
+++ src/main/java/com/github/jvanheesch/wicket/WicketApplication.java
@@ -27,6 +27,6 @@ public class WicketApplication extends WebApplication {
super.init();
// add your configuration here
- this.setRootRequestMapper(new
CryptoMapper(this.getRootRequestMapper(), this));
+// this.setRootRequestMapper(new
CryptoMapper(this.getRootRequestMapper(), this));
}
{code}
and it fails with OOM just as the original version with CryptoMapper.
With getSession().setMaxInactiveInterval(1) the issue changes to
"OutOfMemoryError: GC overhead limit exceeded".
In my opinion this ticket can be closed as "Not a problem"
> Adding CryptoMapper as RootRequestMapper results in OutOfMemoryError.
> ---------------------------------------------------------------------
>
> Key: WICKET-6633
> URL: https://issues.apache.org/jira/browse/WICKET-6633
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 8.2.0
> Reporter: Joris van Heesch
> Assignee: Martin Grigorov
> Priority: Major
>
> I created a simple Wicket reproducer, starting from a Wicket Quickstart.
> The reproducer consists of the following:
> - HomePage
> - stylesheet.css, used in HomePage via
> response.render(CssHeaderItem.forReference(...)).
> - MimicBrowserPageLoads: a simple java application (main method) that mimics
> browser requests to HomePage: it does 1 GET request for the html, and 1 GET
> for the css. It does this 100.000 times, clearing the cookies after each
> 'page load'.
> h2. The problem
> When I remove the CryptoMapper and start jetty using the quickstart's code,
> adding -Xms64m -Xmx64m, all works fine: I can run MimicBrowserPageLoads, and
> no problems arise.
> However, when I configure CryptoMapper as the application's
> RootRequestMapper and start jetty, again adding -Xms64m -Xmx64m, starting
> MimicBrowserPageLoads will, after some time, result in OutOfMemoryError for
> the jetty process.
> The reproducer can be found here:
> [https://github.com/jvanheesch/cryptomapper-outofmemoryerror]
> The same problem occurs when deploying with Tomcat 9.0.14.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)