You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Kathey Marsden (Commented) (JIRA)" <ji...@apache.org> on 2012/02/17 20:34:04 UTC

[jira] [Commented] (DERBY-5328) The private fields of the NetServlet can be changed by multiple threads, giving rise to race conditions and corruptions.

    [ https://issues.apache.org/jira/browse/DERBY-5328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13210468#comment-13210468 ] 

Kathey Marsden commented on DERBY-5328:
---------------------------------------

Rick committed a change for this issue:
	#1155367 	Tue Aug 09 13:56:04 UTC 2011 	rhillegas 	DERBY-5328: Improve the re-entrancy of the NetServlet.
Files Changed
MODIFY /db/derby/code/trunk/java/drda/org/apache/derby/drda/NetServlet.java
Comment 

Is it fixed or is there more work to do?


                
> 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
>         Attachments: derby-5328-01-aa-simpleFields.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