search cancel

CA GEN Java EJB Web Service call timeout occurs after 60 seconds (WildFly/JBoss)

book

Article ID: 188942

calendar_today

Updated On:

Products

Gen Gen - Run Time Distributed

Issue/Introduction

We are developing a new GEN app, which is generated and compiled as Java.
The app is cooperative packaged.
The client are generated as: JVM/Java/INTERNET
The servers are generated as: JVM/JAVA/EJB Web services/Oracle/Java RMI
The Application Server is jboss/wildfly-14.0.1.Final

There are some servers that do quite a lot of processing, so the EJB request can take a lot to complete and sometimes a timeout error occurs i.e.

===
09:58:39,674 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (com.ca.gen85.smrt.ServletSession) Interceptor for {http://tempuri.org/.../...#{http://cxf.apache.org/jaxws/dispatch}Invoke has thrown exception, unwinding now: org.apache.cxf.interceptor.Fault: Could not receive Message.
        at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:65)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:537)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:446)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:361)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
        at org.apache.cxf.endpoint.ClientImpl.invokeWrapped(ClientImpl.java:354)
        at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:322)
        at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:241)
        at com.ca.gen85.odc.coopflow.ws.WSDynamicCoopFlow.doFlow(Unknown Source)
...
Caused by: java.net.SocketTimeoutException: SocketTimeoutException invoking http://localhost:8080/.../.../...: Read timed out
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1402)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1386)
        at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
        at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:673)
        at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63)
        ... 43 more
Caused by: java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
  ...
  at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
        at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream$2.run(URLConnectionHTTPConduit.java:377)
        at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream$2.run(URLConnectionHTTPConduit.java:373)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:373)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1599)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1627)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1572)
        at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1373)
        ... 46 more
  
09:58:39,685 INFO  [stdout] (com.ca.gen85.smrt.ServletSession) 04/16/20-09:58:39:685[com.ca.gen85.smrt.ServletSession]: WSDynamicCoopFlow.processException.WS.Exception(): Read timed out
===

The timeout seems to be 60 seconds, How can we increase the timeout?

Cause

This is a web service call where JBoss/WildFly uses Apache CXF which itself has a client side receive timeout parameter ReceiveTimeout that defaults to 60000 milliseconds i.e. 60 seconds:
http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport(includingSSLsupport)-Theclientelement
"ReceiveTimeout: Specifies the amount of time, in milliseconds, that the client will wait for a response before it times out. The default is 60000.
0 specifies that the client will wait indefinitely."

Environment

Release : 8.5
Component : CA Gen Enterprise Java Beans

Resolution

The Apache CXF/HTTPConduit timeouts can be configured in WildFly as system properties per this WildFly 14 Developer Guide page:
https://docs.wildfly.org/14/Developer_Guide.html
See section "HTTPConduit configuration"
cxf.client.receiveTimeout corresponds to the ReceiveTimeout.

The environment variable JAVA_OPTS in file standalone.conf (or under Windows standalone.conf.bat) was used to set the system property "cxf.client.receiveTimeout" to 900 seconds (15 minutes) i.e.
JAVA_OPTS=-Dcxf.client.receiveTimeout=900000

It was also found that 2 additional timeout settings needed to be set as follows:
1. In standalone.xml, for the datasource definition set the idle timeout to 15 minutes:
                    <timeout>
                        <idle-timeout-minutes>15</idle-timeout-minutes>
                    </timeout>
3. In standalone.xml, add <coordinator-environment default-timeout="900" /> to this existing section to set the transaction timeout to 900 seconds (15 minutes):
        <subsystem xmlns="urn:jboss:domain:transactions:5.0">
            <core-environment node-identifier="${jboss.tx.node.id:1}">
                <process-id>
                    <uuid/>
                </process-id>
            </core-environment>
            <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
            <object-store path="tx-object-store" relative-to="jboss.server.data.dir"/>
            <coordinator-environment default-timeout="900" />
        </subsystem>


Additional Information

NOTE: Gen 8.5 is only officially supported with JBoss Application Server 5.1, and has not been certified with the WildFly or JBoss EAP Application Servers. Gen 8.6 is officially supported with the WildFly or JBoss EAP Application Servers. More details here:
https://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-mainframe-software/devops/ca-gen/8-5/technical-requirements/third-party-software-version.html
https://techdocs.broadcom.com/content/broadcom/techdocs/us/en/ca-mainframe-software/devops/ca-gen/8-6/technical-requirements/third-party-software-version.html