hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 13463] - Request/Response race condition when doing multiple requests on the same connection.
Date Fri, 21 Feb 2003 22:36:15 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13463>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13463

Request/Response race condition when doing multiple requests on the same connection.





------- Additional Comments From mike.vannoord@brainna.com  2003-02-21 22:36 -------
The original problem (the race condition) still exists, though the reason for 
it may have changed.  Consider this scenario:

1) The Method executes using a connection aquired from the 
SimpleHttpConnectionManager.
2) The response is read until there is no more data (i.e. InputStream.read() 
== -1).
3) The connection gets returned to the manager ready to be used again, i.e. no 
sockets/streams are closed.
4) A new Method submits a request to an HTTP server using the existing 
connection.
5) The Method attempts to read the server's response before the server has 
prepared it (its a very inefficient server...not like tomcat ;) )
6) The connection's InputStream.read() will return -1 and the Method will 
assume the response is invalid (it'll throw the "HttpRecoverableException: 
Error in parsing the status  line from the response: unable to find line 
starting with "HTTP/"" exception).

Hopefully my test case will demonstrate this scenario.  It can quite easily be 
fixed by simply waiting for the response before starting to read it.  
HttpConnection already has a "waitForResponse()" method which could be used 
(although waitForResponse() will seriously burn some CPU cycles if not tweeked 
a little).

Mime
View raw message