Welcome Guest, Not a member yet? Register   Sign In
Oversight in xmlrpcs causes huge memory usage
#1

[eluser]chriskl[/eluser]
In the XMLRPC server library, a debug check is missing on this line:

$plist .= "$i - " . print_r(get_object_vars($parser_object->xh[$parser]['params'][$i]), TRUE). ";\n";

This causes it to unnecessarily build up gigantic strings during very large XMLRPC requests. It's necessary to change it to:

if ($this->debug === TRUE)
{
$plist .= "$i - " . print_r(get_object_vars($parser_object->xh[$parser]['params'][$i]), TRUE). ";\n";
}

Cheers,

Chris
#2

[eluser]Jim OHalloran[/eluser]
That looks like the issue I raised a while ago. According to Derek it will be fixed in the next version of the framework. You might want to check this thread to make sure we're talking about the same thing.

Jim.
#3

[eluser]chriskl[/eluser]
Ah yes, same issue Smile

Now...why if I turn on logging to level 2 to see debugging messages do I see several hundred 'xmlrpc has been initialized' and 'xss filter has been applied' style messages for a SINGLE xmlrpc request?

XMLRPC is about 200x faster with logging on 1 instead of 2 on my machine. Literally.

Chris
#4

[eluser]Jim OHalloran[/eluser]
I'd noticed the same thing in my app. I'm guessing the speed increase is due to less disk activity with logging off, but I'm not sure what the class constructor is called so many times on large structures. The number of messages seems to be related to the number of elements in an array, but I never really tracked it down. My API doesn't handle much traffic and performance was acceptible as it is.

Jim.
#5

[eluser]Derek Allard[/eluser]
Chris, if you want, you can grab a copy of the new version now. Its in the repository here. Just replace your current lib/xmlrpcs.php and you should be good to go.
#6

[eluser]chriskl[/eluser]
We actually use PH 5.2.3 (or whichever version has the issue), so we need this change too:

//-------------------------------------
// Get Data
//-------------------------------------

if ($data == '')
{
$data = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents('php://input');
}

I'd strongly recommend you apply that to the repository Smile

Also, in xmlrpc.php there is a spelling mistake:

$this->xmlrpcstr['invalid_return'] = 'The XML data receieved was either invalid or not in the correct form for XML-RPC. Turn on debugging to examine the XML data further.';
#7

[eluser]chriskl[/eluser]
Oh, also that 'class constructor being called for every element in xmlrpc request' issue that Jim and I ran into above - has that been fixed? I'm submitting huge xmlrpc request and it _kills_ my test machine...
#8

[eluser]Derek Allard[/eluser]
We welcome any insight you could provide chris




Theme © iAndrew 2016 - Forum software by © MyBB