Hello, We are experiencing some thread/race condition problems with HttpSession isNew() for Tomcat 6 (specifically for 6.0.18 but we have seen the problem in prior versions too). We narrowed it down to a small example.
The flow is quite simple. 1. Request first.jsp 2. Request second.jsp Randomly we get the text "This should not happen, the session should not be new on this page" printed out. We are using jMeter to generate load, running 150 concurrent users. Page first.jsp: --------------------- <% session.setAttribute("sessionTest", "test"); %> <html> <head><title>Session is New Test</title></head> <body>Page one sets a value one the session.</body> </html> --------------------- Page second.jsp: --------------------- <% boolean newSession = false; if (session.isNew()) { if (session.getAttribute("sessionTest") != null) { newSession = true; System.out.println("This should not happen, the session should not be new on this page."); } } %> <html> <head><title>Session is New Test</title></head> <body>Page to two the session should not be new, isNew = <%=newSession%></body> </html> --------------------- Our feeling is that this is a race condition between threads before tomcat set isNew to false. A quick workaround is to use request.getSession(false) and null checks. This seems to get us around our specific application problem. Could this be a problem in Tomcat? Regards, Jakob Ericsson --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org