I'm doing some performance testing on an AppFuse-based application that uses Acegi Security heavily. Using 20 concurrent users, I start to see the following error after about 6 minutes:
This seems to be triggered by my logout.jsp, which is:Code:ERROR [http-8080-Processor25] [jsp].invoke(260) | Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.Request.doGetSession(Request.java:2206) at org.apache.catalina.connector.Request.getSession(Request.java:2024) at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:831) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:215) at org.acegisecurity.ui.WebAuthenticationDetails.<init>(WebAuthenticationDetails.java:55) at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.createAuthentication(AnonymousProcessingFilter.java:99) at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:140) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303) at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:165) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303) at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:50) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:246) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303) at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:220) at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303) at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:173) at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:613)
I've tried changing <c:redirect/> to <jsp:forward/>, but that didn't help either. BTW, it's cool to see that forwarding now works (I'm using AS 1.0.0 RC2) - I remember having to redirect in previous versions.Code:%@ include file="/common/taglibs.jsp"%> <%@ page import="javax.servlet.http.Cookie" %> <%@ page import="org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices" %> <% session.invalidate(); Cookie terminate = new Cookie(TokenBasedRememberMeServices.ACEGI_SECURITY_HASHED_REMEMBER_ME_COOKIE_KEY, null); terminate.setMaxAge(0); response.addCookie(terminate); %> <c:redirect url="/"/>
The strange thing is that everything works fine under normal load, and you never see this exception in the logs. It only happens under heavy load - but it takes 6 minutes or so for this to happen.
The good news is I've been able to achieve the following numbers (don't know how these compare to others):
20 active users
41 pages per second
10 MB per second
In 130,000 pages served, errors only occur on 415, and they're all from logout.jsp. 0.32 % isn't too bad is my guess. ;-)
Any ideas why logout.jsp could be causing this problem? It's possible my test is invalid. However, all I did was recorded using WAPT - and clicked through 45 different pages, logging out at the end.
http://www.loadtestingtool.com/
Thanks,
Matt


