This is an "interaction" issue between the HttpURLConnection with keep-alives 
and the socket listener.   With Keep-Alives turned on,  the client holds the 
socket open for 15 seconds to see if there is another request to send.   When 
jetty shuts down, for some reason, that socket cannot be completely closed 
due to the open connection.   When it restarts, it re-opens the socket, but 
it ends up in a bizzare state as it wasn't able to completely close it 
before.   This is completely reproducable with just a HttpURLConnection and 
jetty serving static files so it's not specific to CXF.  

This is one reason we added a system property 
-Dorg.apache.cxf.transports.http_jetty.DontClosePort=true
that will instruct the Jetty transport to not actually close the port for our 
unit tests.   When the start is next called, it will just use the already 
open port.

A workaround is to turn off the Keep-Alives on the client.   Performance will 
definitely degrade though if you do a LOT of requests one after another (in 
that 15 second period when the connection is left open.

Dan


On Tuesday 07 October 2008 5:21:19 pm Will Gomes wrote:
> I'm using jetty to deploy cxf services. I have tried to execute the
> sequence below using JaxWsProxyFactoryBean and JaxWsAPI service.getPort to
> get the client.  When using the latter everything works. When using the
> proxy factory bean, the last call (step 5) results in a socket exception,
> unless there is some sort of pause in between step 3 & 4. Is there bug in
> proxy factory? I've attached sample project to demonstrate the issue.
> http://www.nabble.com/file/p19867556/CXF_Jetty_Bug.zip CXF_Jetty_Bug.zip
>
> 1. Start jetty
> 2. Get client & make service call
> 3. Stop jetty
> 4. Start jetty
> 5. Get client & make service call
>
>
> Also, any word on the following JIRA issue:
>
> https://issues.apache.org/jira/browse/CXF-1821



-- 
Daniel Kulp
[EMAIL PROTECTED]
http://dankulp.com/blog

Reply via email to