You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "metatech (JIRA)" <ji...@apache.org> on 2012/11/27 21:44:58 UTC

[jira] [Commented] (CXF-4524) Large request causes socket timeout on subsequent requests on WebLogic hosted service

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

metatech commented on CXF-4524:
-------------------------------

There seems to be a problem between the client-side and the server-side of the "Keep-Alive" mechanism.
If the keep-alive on a connection times out first on server-side, it closes the connection in a way that the client-side HttpUrlConnection does not detect that the connection is closed, and any subsequent request on this connection will generate a time-out after a very long time, typically 5 minutes if you have an Apache server between the CXF client and the server (indicated by an HTTP error 400 in the logs). The 2 sides of the connection seem to wait for each other for several minutes.

Solutions : 
1. disable "keep-alive" (but with a potential performance overhead when many requests are sent in a loop to the same server), 
2. use Commons-Httpclient as HTTP client stack within CXF (implemented in CXF 2.7.0 with CXF-4525/CXF-291)
3. define the Keep-Alive duration on the server (including intermediate Apache server) higher than the Keep-Alive duration on the client.

3.1. On the client-side, you can decrease the Keep-Alive duration :

On WebLogic, the java.net.HttpURLConnection implementation is not using the JVM built-in "sun.net.www.http" implementation, but is using a enhanced version by WebLogic, packaged as "weblogic.net.http".
Both have a "KeepAliveCache" class, which keeps opened HTTP connections in a pool for a few seconds, the exact number depending on the implementation :
sun.net.www.http.KeepAliveCache.LIFETIME = 5 seconds (cannot be overriden)
weblogic.net.http.KeepAliveCache.LIFETIME = 15 seconds (can be overriden with system property "http.keepAliveCache.lifeTime=5000" in milliseconds)

3.2. On the server-side, you can increase the Keep-Alive duration : 

3.2.1. Apache Server :
    KeepAlive On
    KeepAliveTimeout 5

3.2.2. WebLogic Server :
WebServerMBean.KeepAliveSecs : the value defines the keep-alive duration on the server-side, it can be changed in the WebLogic web console.  Default is 30 seconds.

                
> Large request causes socket timeout on subsequent requests on WebLogic hosted service
> -------------------------------------------------------------------------------------
>
>                 Key: CXF-4524
>                 URL: https://issues.apache.org/jira/browse/CXF-4524
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.6.2
>         Environment: WebLogic 10.3.0.0
>            Reporter: Chris Pimlott
>         Attachments: stacktrace.client.txt, stacktrace.weblogic.txt, weblogic-socketTimeoutBug.zip
>
>
> I discovered an odd bug that appears to be some sort of interaction between CXF, WebLogic and HTTP keepalives.  I have a simple service in a webapp hosted in WebLogic 10.3.0.0.  I am hitting that service with a client stub generated from WSDL by cxf-codegen-plugin.
> The steps are as follows:
> 1. Create a new client service object
> 2. Make a first call, passing a fairly large (1000) list of strings
> 3. Make a second call to any method
> The first call executes properly, but the second call fails with a socket timeout.
> If the first call has a smaller or empty list of strings, the issue does not occur.
> If you add a delay of approx. 5 seconds between the two calls, the issue does not occur.  Shorter delays don't seem to be sufficient.
> If you disable HTTP keepalives, either on the client (via System property) or on the server, the issue does not occur.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira