View Full Version : RPC Timeouts
dtabuenc
11-11-2004, 07:07 PM
I'm trying to use XML-RPC but if calls take longer than a few seconds (around 10) they timeout. Is there a way to set the timeout? Is there something that can be done on the "ontimeout" event to make it keep waiting?
pablo
11-11-2004, 11:39 PM
Hi there,
I'm trying to use XML-RPC but if calls take longer than a few seconds (around 10) they timeout. Is there a way to set the timeout?
Two places where timeouts can occur are in the client (i.e. your Laszlo application) and in the LPS.
The underlying LFC object that <xmlrpc> uses to make requests is LzXMLRPCService, whose default timeout value is 30 seconds (30000 milliseconds to be exact). To change this value, you need to set its timeout value like:
<xmlrpc ...>
<method event="oninit">
/* note: timeout value is in milliseconds */
var mytimeout = 60000;
LzXMLRPCService.__lzLoader.timeout = mytimeout;
</method>
</xmlrpc>
Keep in mind that modifying the value in LzXMLRPCService will affect any other xmlrpc objects since its a service.
There is a feature enhancement for RPC objects to provide better timeout support in the future and this will be documented. :)
The server is the second point where your xlmrpc request can timeout, since it acts as an XML-RPC proxy on behalf of your application. As you've already discovered, the server's timeout value for backend http requests is 10 seconds. To change this value, go to your WEB-INF/lps/config/lps.properties file and modify these properties:
# in milliseconds
http.backendTimeout=10000
http.backendConnectionTimeout=10000
Changing these values will also affect the timeout values for all other server-related http requests, e.g., data, media, SOAP, etc. You'll need to restart the server for your changes to take effect.
Is there something that can be done on the "ontimeout" event to make it keep waiting?
You should be listening for timeout events (as well as errors) using onerror:
http://www.laszlosystems.com/lps-2.2/docs/reference/rpc.html#attr-onerror
http://www.laszlosystems.com/lps-2.2/docs/reference/xmlrpc.html
You can view the type of error in the debugger like:
<method event="onerror" args="errmsg">
Debug.write('err type:', errmsg);
</method>
Hope this helps!
Cheers,
pablo
spoco2
05-11-2006, 10:17 PM
So, I've seen that this has been asked for a number of times, and I've also found that this solution doesn't work because of the dreaded reference to undefined variable 'LzXLMRPCService'
error.
Is this a new feature that is available in a nightly build? Is it coming soon? Is there another backdoor way to get it working at present?
Seems to be a popular request.
pablo
05-12-2006, 11:34 AM
Sorry, "LzXLMRPCService" should be LzXMLRPCService. I just fixed the posting.
Thanks,
pablo
spoco2
05-14-2006, 04:26 PM
Hi, Thanks for the update.
I still get an error when trying the new spelling, but now it's complaining that there is no property called LzLoader, so it does recognize the first part now.
I have hunted through the code for the rpc stack and I can't find anything defining either timeout or lzLoader:
<class name="AppRPC" extends="xmlrpc">
<attribute name="callbackstack"/>
<method event="oninit">
this.callbackstack = new Array();
/* note: timeout value is in milliseconds */
var mytimeout = 60000;
LzXMLRPCService.__lzLoader.timeout = mytimeout;
</method>
WARNING: ****.lzx:20: reference to undefined property '__lzLoader'
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.