Re: Long lasting calls

Gaetano Giunta <[email protected]> Tue, 31 Aug 2010 22:38:16 +0200
Newsgroups gmane.comp.php.xml-rpc
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============0468939944==
Content-Type: multipart/alternative;
 boundary="------------090102080006040805050906"

This is a multi-part message in MIME format.
--------------090102080006040805050906
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

  Attila wrote:
> Hi,
>
> We are using the phpxmlrpc 2.2.2 package in our code.
>
> An issue we run into is very long lasting calls.  We have methodCalls that are expected to take anywhere between 5 - 15 minutes.
>
> The problem is that there is a timeout somewhere.
>
> In the FAQ there is a section titled:
>
>
>     How to enable long-lasting method calls
>
> Can you provide a quick pointer on how to prevent the library from timing out?
>

Not really hard - it's just that are more than one place where a timeout is imposed:
1. use the timeout parameter in the send() method call [client side]
2. set the php script timeout limit: parameter max_execution_time in in php.ini (or via an ini_set() call if you cannot alter php.ini eg. on shared hosting) 
[both client and server]
3. make sure that the webserver serving the request does not time out in itself, e.g. the TimeOut directive for Apache might have an impact

For debugging purposes:
1. use debug level 3 on the phpxmlrpc client
2. use a network sniffer such as Wireshark

bye
Gaetano

ps: for such long-lasting methods, it might be better off to split processing in multiple xmlrpc calls:
one that starts processing, gets back a token
then a loop that every X seconds asks with the given token if results are ready
server-side, the ignore_user_abort() php function could be used to make sure processing of the first call continues after sending the token response to the client

> Thank you,
>
> -A
>
>
> _______________________________________________
> phpxmlrpc mailing list
> [email protected]
> http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc


--------------090102080006040805050906
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Attila wrote:
    <blockquote
      cite="mid:[email protected]"
      type="cite">Hi,<br>
      <br>
      We are using the phpxmlrpc 2.2.2 package in our code.<br>
      <br>
      An issue we run into is very long lasting calls.&nbsp; We have
      methodCalls that are expected to take anywhere between 5 - 15
      minutes.<br>
      <br>
      The problem is that there is a timeout somewhere.<br>
      <br>
      In the FAQ there is a section titled:<br clear="all">
      <h2 class="title" style="clear: both;">How to enable long-lasting
        method calls</h2>
      Can you provide a quick pointer on how to prevent the library from
      timing out?<br>
      <br>
    </blockquote>
    <br>
    Not really hard - it's just that are more than one place where a
    timeout is imposed:<br>
    1. use the timeout parameter in the send() method call [client side]<br>
    2. set the php script timeout limit: parameter max_execution_time in
    in php.ini (or via an ini_set() call if you cannot alter php.ini eg.
    on shared hosting) [both client and server]<br>
    3. make sure that the webserver serving the request does not time
    out in itself, e.g. the TimeOut directive for Apache might have an
    impact<br>
    <br>
    For debugging purposes:<br>
    1. use debug level 3 on the phpxmlrpc client<br>
    2. use a network sniffer such as Wireshark<br>
    <br>
    bye<br>
    Gaetano<br>
    <br>
    ps: for such long-lasting methods, it might be better off to split
    processing in multiple xmlrpc calls:<br>
    one that starts processing, gets back a token<br>
    then a loop that every X seconds asks with the given token if
    results are ready<br>
    server-side, the ignore_user_abort() php function could be used to
    make sure processing of the first call continues after sending the
    token response to the client<br>
    <br>
    <blockquote
      cite="mid:[email protected]"
      type="cite">Thank you,<br>
      <br>
      -A<br>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
phpxmlrpc mailing list
<a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
<a class="moz-txt-link-freetext" href="http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc">http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>

--------------090102080006040805050906--

--===============0468939944==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
phpxmlrpc mailing list
[email protected]
http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc

--===============0468939944==--