Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A692C9C06 for ; Wed, 4 Apr 2012 06:59:48 +0000 (UTC) Received: (qmail 1521 invoked by uid 500); 4 Apr 2012 06:59:48 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 1379 invoked by uid 500); 4 Apr 2012 06:59:44 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 1341 invoked by uid 99); 4 Apr 2012 06:59:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Apr 2012 06:59:42 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Apr 2012 06:59:40 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 1EF43357D42 for ; Wed, 4 Apr 2012 06:59:19 +0000 (UTC) Date: Wed, 4 Apr 2012 06:59:19 +0000 (UTC) From: "Kristian Waagan (Updated) (JIRA)" To: derby-dev@db.apache.org Message-ID: <832247977.10580.1333522759171.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1233468713.10293.1310573703675.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (DERBY-5328) The private fields of the NetServlet can be changed by multiple threads, giving rise to race conditions and corruptions. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-5328?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kristian Waagan updated DERBY-5328: ----------------------------------- Committed patch 02-aa to trunk with revision 1309264. I don't plan any more work on this issue, and I expect that we can resolve this issue. > The private fields of the NetServlet can be changed by multiple threads, giving rise to race conditions and corruptions. > ------------------------------------------------------------------------------------------------------------------------ > > Key: DERBY-5328 > URL: https://issues.apache.org/jira/browse/DERBY-5328 > Project: Derby > Issue Type: Bug > Components: Network Server > Affects Versions: 10.9.0.0 > Reporter: Rick Hillegas > Labels: derby_triage10_9 > Attachments: derby-5328-01-aa-simpleFields.diff, derby-5328-02-aa-synchronized_doget.diff > > > At the beginning of the NetServlet class, there are a number of private fields. These fields can be inspected and changed by any thread running inside NetServlet.doGet(). Due to the way that app servers dispatch servlet requests, this means that multiple threads can be operating inside doGet() at the same time, clobbering one another's work. The weirdest instance of this is the shared PrintWriter (called "out") which is used to produce the response web page sent back by the servlet. Multiple threads all writing to the same PrintWriter will create a very bizarre response page. The following improvements should be made: > 1) The "server" field should be set by a synchronized method. > 2) Every run through doGet() should create its own PrintWriter which is passed to other methods. The instance-wide "out" field should be removed. > 3) Various other fields should be re-coded using the Atomic classes introduced by Java 5. These fields include "logStatus" and "traceStatus". This solution can be implemented if the community votes to approve the sunsetting of JVM 1.4 (currently at the polls). -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira