cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2991
Views
31
Helpful
5
Replies

Rest Call Timeout Error Handling

dchumbley
Level 1
Level 1

I have a cvp studio application that is using the Rest Client element.  We are seeing frequent timeout errors when making the Rest call.  The Read timeout is set at 30000 currently.  We're finding that sometimes the call is taking longer than that.  Currently when this time expires the call is dropped.  In the events on the Rest Client element I configured an event for java.net.SocketTimeoutException and one for java.lang.Exception thinking that would allow the call to continue on instead of getting dropped.  I must not have my Event set correctly though given the call drop.  The error log is below.  I'm wondering what I should set the Error Event as to capture this correctly and not drop the call?  On the other side we realize this REST call shouldn't take that long and are working on that as well, but still want/need to figure out what to do if the Read timeout occurs.  Thanks!

.1517949183121.604516.GetProductsById,02/06/2018 14:33:33.793, The error was: A built-in element encountered an exception of type com.sun.jersey.api.client.ClientHandlerException. The root cause was: com.sun.jersey.api.client.ClientHandlerException: java.net.SocketTimeoutException: Read timed out

com.audium.server.AudiumException: A built-in element encountered an exception of type com.sun.jersey.api.client.ClientHandlerException.

    at com.audium.server.voiceElement.ActionElementBase.service(ActionElementBase.java:416)

    at com.audium.server.controller.Controller.goToAction(Controller.java:4363)

    at com.audium.server.controller.Controller.goToElement(Controller.java:3999)

    at com.audium.server.controller.Controller.continueCall(Controller.java:3679)

    at com.audium.server.controller.Controller.doPost(Controller.java:1099)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)

    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)

    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)

    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)

    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)

    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

    at java.lang.Thread.run(Thread.java:745)

Caused by: com.sun.jersey.api.client.ClientHandlerException: java.net.SocketTimeoutException: Read timed out

    at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:151)

    at com.sun.jersey.api.client.Client.handle(Client.java:648)

    at com.sun.jersey.api.client.WebResource.handle(WebResource.java:680)

    at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)

    at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:507)

    at com.audium.server.action.rest.client.RestClientUtil.doGet(RestClientUtil.java:449)

    at com.audium.server.action.rest.client.RestClientUtil.executeAPI(RestClientUtil.java:314)

    at com.audium.server.action.rest.client.RestClientAction.doAction(RestClientAction.java:280)

    at com.audium.server.voiceElement.ActionElementBase.service(ActionElementBase.java:390)

    ... 26 more

Caused by: java.net.SocketTimeoutException: Read timed out

    at java.net.SocketInputStream.socketRead0(Native Method)

    at java.net.SocketInputStream.read(SocketInputStream.java:152)

    at java.net.SocketInputStream.read(SocketInputStream.java:122)

    at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)

    at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)

    at java.io.BufferedInputStream.read(BufferedInputStream.java:334)

    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)

    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633)

    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1323)

    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)

    at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:249)

    at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:149)

    ... 34 more

.1517949183121.604516.GetProductsById,02/06/2018 14:33:33.871,A VoiceXML error occurred of type "error.badfetch"

.1517949183121.604516.GetProductsById,02/06/2018 14:33:33.871,An error has occurred.

5 Replies 5

janinegraves
Spotlight
Spotlight

The error at the bottom of your log 'error.badfetch' means that the

voicexml gateway is timing out. That may be why it's 'dropping' the call.

Right before your rest call, in the audio element just prior, go into

the Settings tab and configure the VoiceXML Properites:

fetchtimeout  60s

fetchaudio     http://media/en-us/app/music.wav (pointToAudioAsFiller)

By the way, it should never 'drop' the call. It should go back to ICM

down the ErrorPath of the GS,Server,V.

If you hear  "I'm sorry, we're experiencing difficulty..." and then it's

'hanging up' - look under the Studio app in

Project/Properties/CallStudio/GeneralSettings. Ensure that 'Subdialog'

is set to 'true' - so it sends unhandled exceptions back to ICM.

Genius, Thanks!

Hey Janine!

 

I am experiencing this issue with the Read Timeout being hit, but the error log does not contain the VXML badfetch error.  Since there is not a bad fetch error, the call does not flow through the Voice XML error catch I have at the beginning of the application.  I also have a catch for all Java exceptions at the beginning of the application.  The error is not caught there either.  So the Cisco message is played and the call is disconnected.  I need to the call to flow through the application error handling and transfer to the agent.  I also verified that the Project Properties has the Subdialog set to True.  Is there a way to capture the read timeout error?  Below is what I see in the error file.

 

Before the REST Client element, I have an audio element with the fetchaudio set and the fetchtimeout set to 30s.  In the REST Client, I updated the Read Timeout from 5000 to 30000, to match the fetchtimeout.  Right now, that is enough time for the service response to be received.  Since both of these settings match 30 seconds, I wonder if the bad fetch would be thrown first, so the call flows through the Voice XML catch.  Or maybe the Read Timeout in the Rest Client should be set higher than the fetchtimeout, to ensure the bad fetch is thrown and the call flows through our transfer logic?

 

xx.xx.xx.xx.xxxxxxxxxxxxx.xx.GroupClaimsTest,04/20/2021 10:28:56.034, The error was: A built-in element encountered an exception of type com.sun.jersey.api.client.ClientHandlerException. The root cause was: com.sun.jersey.api.client.ClientHandlerException: java.net.SocketTimeoutException: Read timed out
com.audium.server.AudiumException: A built-in element encountered an exception of type com.sun.jersey.api.client.ClientHandlerException.
at com.audium.server.voiceElement.ActionElementBase.service(ActionElementBase.java:416)
at com.audium.server.controller.Controller.goToAction(Controller.java:4386)
at com.audium.server.controller.Controller.goToElement(Controller.java:4022)
at com.audium.server.controller.Controller.continueCall(Controller.java:3702)
at com.audium.server.controller.Controller.doPost(Controller.java:1116)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.sun.jersey.api.client.ClientHandlerException: java.net.SocketTimeoutException: Read timed out
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:151)
at com.sun.jersey.api.client.Client.handle(Client.java:648)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:680)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:568)
at com.audium.server.action.rest.client.RestClientUtil.doPost(RestClientUtil.java:460)
at com.audium.server.action.rest.client.RestClientUtil.executeAPI(RestClientUtil.java:316)
at com.audium.server.action.rest.client.RestClientAction.doAction(RestClientAction.java:280)
at com.audium.server.voiceElement.ActionElementBase.service(ActionElementBase.java:390)
... 26 more
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:442)
at sun.security.ssl.InputRecord.read(InputRecord.java:480)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:946)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:903)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:690)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1366)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:249)
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:149)
... 34 more

 

 

 

 

One thing to catch this - and you should do it for all cvp call studio apps, is to create a default error Cisco Sub Dialog Return.

 

1) Add in a Cisco Sub Dialog Return Element

2) RIght click and select "error element" 

3) Fill in values you want on an error to be sent back to ICM / CCE - so you know how to handle the call.

 

This will catch this error I believe.

 

Another thing you can do - is improve the error handling of your JAVA code - so it won't give a Java error etc.

 

Regards,

Gerry

Thanks!!

 

The workaround I have done is to set the Read Timeout and the Connect Timeout in the Rest_Client element to 35 seconds, so it is greater than the fetchtimeout of 30 seconds.  This forces the bad fetch error and is caught in our VXML error catch.  When the Read Timeout is hit, it is not being seen as a Java Exception, so it is not being caught in the Java error catch we have coded in call studio app.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: