You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Sebastian Turullols <se...@activephoto.com> on 2000/11/09 02:46:19 UTC

mod_jserv/6822: JServInputStream.available() does not implement JavaSoft standard

>Number:         6822
>Category:       mod_jserv
>Synopsis:       JServInputStream.available() does not implement JavaSoft standard
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    jserv
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Wed Nov 08 17:50:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     sebastian@activephoto.com
>Release:        1.3.12
>Organization:
apache
>Environment:
Redhat Linux 6.2
>Description:
According to Sun, this is what InputStream.available() should do:

Determines the number of bytes that can be read from this input stream without blocking. The available method of InputStream returns 0. This method should be overridden by subclasses. 

JServInputStream.available() does not obey this rule.  It returns the difference between the CONTENT-LENGTH HTTP header and the amount of data that has already been read.  If the socket connection is dropped .available() will say that data is available for a non-blocking read when it is not.  This is VERY BAD because servlet threads will hang forever on reads.
>How-To-Repeat:

>Fix:

This bug is EXTREMELY easy to fix.  It turns out that the SocketInputStream in that is a member of JServInputStream correctly implements the available() method.  

All JServInputStream should do is:
   
   return in.available()
>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <ap...@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]