Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 1316 invoked from network); 10 Dec 2003 23:44:25 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 10 Dec 2003 23:44:25 -0000 Received: (qmail 23486 invoked by uid 500); 10 Dec 2003 23:43:52 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 23206 invoked by uid 500); 10 Dec 2003 23:43:51 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 23193 invoked from network); 10 Dec 2003 23:43:50 -0000 Received: from unknown (HELO lakemtao08.cox.net) (68.1.17.113) by daedalus.apache.org with SMTP; 10 Dec 2003 23:43:50 -0000 Received: from tigger.zoraptera.com ([68.105.227.155]) by lakemtao08.cox.net (InterMail vM.5.01.06.05 201-253-122-130-105-20030824) with ESMTP id <20031210234353.KOBS5790.lakemtao08.cox.net@tigger.zoraptera.com> for ; Wed, 10 Dec 2003 18:43:53 -0500 Received: from tigger.zoraptera.com (localhost.localdomain [127.0.0.1]) by tigger.zoraptera.com (8.12.8/8.12.8) with ESMTP id hBANhqk5010473 for ; Wed, 10 Dec 2003 17:43:52 -0600 Received: (from anthony@localhost) by tigger.zoraptera.com (8.12.8/8.12.8/Submit) id hBANhnax010470 for tomcat-user@jakarta.apache.org; Wed, 10 Dec 2003 17:43:49 -0600 X-Authentication-Warning: tigger.zoraptera.com: anthony set sender to anthony@zoraptera.com using -f Subject: response.reset() and forward() ... problematic? DBCP related? From: Anthony Presley To: tomcat-user@jakarta.apache.org Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1071099829.7825.167.camel@tigger> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Wed, 10 Dec 2003 17:43:49 -0600 X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Found to be clean X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi all, Decided to move my discussion from Commons to Tomcat, as the bug-tracking process appears that this is a more relevant place to post. I'm not using a MVC implementation (ala Struts), but I do have about 100K lines of servlets and JSP's, and I'm having a lot of errors, which scale based on the number of users. For instance, assuming I have around 10 people working on the system, I will have no errors. As that number scales, it becomes a huge problem, and lots of error's start showing up. I've tracked down and squashed most of the DB errors, but am left with the following quandry: I'm not storing any data in the session, and use forward() ... a lot. When the following code executes, and I only open one request (ie, I click on the link to open a new window which fetches a servlet response), it works flawlessly. When I click more than once, I start getting forward() errors. Here's some code snippets: protected void forward(String s) { ServletConfig sc = null; ServletContext sContext = null; RequestDispatcher rd = null; try { sc = this.getServletConfig(); } catch (Exception e) { log("2ERROR Exception: " + e.getMessage()); e.printStackTrace(); } try { sContext = sc.getServletContext(); } catch (Exception e) { log("3ERROR Exception: " + e.getMessage()); e.printStackTrace(); } try { rd = sContext.getRequestDispatcher(s); } catch (Exception e) { log("4ERROR Exception: " + e.getMessage()); e.printStackTrace(); } try { log ("Buffer size is: " + res.getBufferSize()); if (rd != null) rd.forward(req, res); else { log("RD is NULL, MAJOR ERROR"); } } catch (ServletException e) { log("5ERROR ServletException: " + e.getMessage()); e.printStackTrace(); } catch (java.io.IOException e) { log("5ERROR java.io.IOException: " + e.getMessage()); e.printStackTrace(); } catch (Exception e) { log("5ERROR Exception: " + e.getMessage()); e.printStackTrace(); } } I will get an error "5ERROR ServletException: Cannot forward after response has been committed". This error is generated when the following conditions exist: 1. More than one user is trying to pull the same information. For instance, if I open three windows, each requesting the same info, two of them will likely error. With twenty requests, I get about sixteen errors [consistently]. 2. More than one user trying to pull different information. Although the error is almost certain to happen when more than one user pulls the same data, pulling different data (simulated with multiple windows), gets me the same error, at about the same frequency. 2. Rerequesting the error'd page will get me the correct output (no changes made to the data or JSP / servlets). 3. I've bumped the response buffer (in the servlet) from 8K to 75K (75000), which reduces the errors, but they are still present. Is there a GOOD way to estimate the amount needed? 4. Using DBCP 1.0 .... using the latest DBCP (1.1?), seems to reduce the errors further (1 in 10, approx). I've rewritten the code to ensure that connections are being opened / closed locally, and quickly. Timing it shows that the DB connection is pulled from the pool for about 2300 milli, and the JSP runs for about 2 milli to display. I'm not 100% sure yet if the problem persists in the JSP (using a simple JSP and simple servlet does not cause these problems, however, the greater the complexity, the higher the likelihood of getting these errors .... which baffle's me, because rerequesting it shows up fine, with nothing in the logs) or the servlet. Anyone seen this before? I'm about at my wits end. Been refactoring for a week now, and still it persists. --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org