[
https://issues.apache.org/jira/browse/WICKET-2191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12694015#action_12694015
]
Johan Compagner commented on WICKET-2191:
-----------------------------------------
that would be cost performance, also the concurrent hashmap is then completely
killed..
Because then we really have a block that is hit by multiply threads that 99.99%
dont have anything to do with each other in a sync block.
i will make it this:
Object removed = bufferedResponses.put(sessionId,
responsesPerSession);
if (removed != null)
{
responsesPerSession.putAll((Map)removed);
}
then if at the very unlikely case, you have to have 2 browser tabs/windows
doing a full page request at exact the same time for a new session
then you get this. then i copy the previous map into the new one.
> WebApplication is not thread-safe
> ---------------------------------
>
> Key: WICKET-2191
> URL: https://issues.apache.org/jira/browse/WICKET-2191
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.5, 1.4-RC2
> Environment: Microsoft Windows Server 2003 SP2, IBM WebSphere 7.0,
> Wicket 1.3.5
> Reporter: Alexei Akimov
> Assignee: Johan Compagner
> Fix For: 1.3.6, 1.4-RC3
>
>
> Instance of class org.apache.wicket.protocol.http.WebApplication is not
> thread safe being shared among several sessions. Concurrent access to it
> leads to errors because of the following:
> 1. bufferedResponses field is initialized with a simple HashMap which is not
> thread safe and can be corrupted when different threads call
> addBufferedResponse, popBufferedResponse or sessionDestroyed methods
> concurrently. Here is the stack trace:
> [27.03.09 20:55:26:669 MSK] 0000009c RequestCycle E
> org.apache.wicket.RequestCycle logRuntimeException <Null Message>
> java.util.ConcurrentModificationException
> at java.util.HashMap$AbstractMapIterator.checkConcurrentMod(Unknown
> Source)
> at java.util.HashMap$AbstractMapIterator.makeNext(Unknown Source)
> at java.util.HashMap$KeyIterator.next(Unknown Source)
> at java.util.HashMap.analyzeMap(Unknown Source)
> at java.util.HashMap.rehash(Unknown Source)
> at java.util.HashMap.rehash(Unknown Source)
> at java.util.HashMap.putImpl(Unknown Source)
> at java.util.HashMap.put(Unknown Source)
> at
> org.apache.wicket.protocol.http.WebApplication.addBufferedResponse(WebApplication.java:639)
> at
> org.apache.wicket.protocol.http.WebRequestCycle.redirectTo(WebRequestCycle.java:201)
> at
> org.apache.wicket.request.target.component.PageRequestTarget.respond(PageRequestTarget.java:58)
> at
> org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:104)
> at
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1181)
> at org.apache.wicket.RequestCycle.step(RequestCycle.java:1252)
> at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353)
> at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
> at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:355)
> at
> org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:145)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
> at
> com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1443)
> at
> com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1384)
> at
> com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)
> 2. Class org.apache.wicket.util.collections.MostRecentlyUsedMap is not
> thread-safe and can be courrupted when different threads call
> addBufferedResponse, popBufferedResponse concurrently.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.