[ 
https://issues.apache.org/jira/browse/CXF-1217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12544968
 ] 

Gary Tully commented on CXF-1217:
---------------------------------

Hi Willem, you may have committed too much!
 I found the 'one' of AllowChunking="false" OR -Dhttp.keepAlive=false works for 
the BusShutdownTest. The problem is the interation of keepAlive and chunking, 
so turning off either should be sufficient. Apologies for not being more clear. 
My preference would be for local versions of cxf.xml in the tests that need it 
rather than adding the configuration to all system tests.

---
On the questions: the keepAlive check interval is not set in HTTPConduit, it is 
set via sun.net.www.http.HttpClient and 
sun.net.www.http.KeepAliveCache.put(URL, Object, HttpClient). It is set via the 
response keep-alive header if present and defaults to 5seconds.

Having the server set a keep-alive header timeout value to say 1 second would 
also have the effect of ensuring that a closed connection is not used but this 
would impact on the value of keep-alive.

The reason a sleep(4000) works is because the first connection is cached in the 
keepAlive cache but gets cleaned out every 5 seconds. It is placed in the cache 
once the response is read. In the mean time, a bus is shutdown, sleep(...) and 
a new  bus are created and 5 seconds pass. The keepAlive cache is cleared of 
any connection that has not been used in 5 seconds.
When the second invocation is made, there is nothing in the keepalive cache and 
a new connection is created as normal.

The problem arises when the second invocation uses a connection from the 
keepAliveCache that is partially closed, ie: the server has done a close. The 
client has to close it when the read fails and thus has to retry by resending 
the request on a new connection. When streaming/chunking is enabled however, 
the full request has not been cached and only the http headers of the request 
are sent, there is no body.  The subsequent read hangs as the server is still 
waiting for the end/rest of the retransmitted request.

Does this make sense?





> Address in use errors from attempt to repeatedly start and stop services
> ------------------------------------------------------------------------
>
>                 Key: CXF-1217
>                 URL: https://issues.apache.org/jira/browse/CXF-1217
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 2.1
>         Environment: Any
>            Reporter: Benson Margulies
>            Assignee: willem Jiang
>         Attachments: busShutdownTest.patch.txt, jetty6.1.6.patch
>
>
> Edit org.apache.cxf.javascript.JsHttpRequestTest to take out the 
> @org.junit.Ignore from the test case that has one, and run from eclipse. 
> Watch the logging traffic. Observe:
> WARNING: failed [EMAIL PROTECTED]
> java.net.BindException: Address already in use: bind
>         at sun.nio.ch.Net.bind(Native Method)
> which eventually, as far as I can tell, turns into:
> INFO: doOpen POST http://localhost:8808/Greeter false
> Nov 18, 2007 10:07:08 PM org.apache.cxf.javascript.JsXMLHttpRequest 
> communicate
> SEVERE: IO error reading response
> java.io.FileNotFoundException: http://localhost:8808/Greeter
> On the other hand, all is well in Eclipse. 
> I will probably commit a workaround to this soon, so it would be good to move 
> this muddle to its own test case.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to