Skip Menu |

This queue is for tickets about the RPC-XML CPAN distribution.

Report information
The Basics
Id: 65341
Status: resolved
Priority: 0/
Queue: RPC-XML

People
Owner: rjray [...] blackperl.com
Requestors: apodran [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.72
  • 0.74
Fixed in: 0.77



Subject: RPC::XML::Server dies on sending large data
RPC::XML::Server dies on sending large data with the following message: ------------------------------------------- Can't locate object method "new" via package "File::Temp" at blib/lib/RPC/XML/Server.pm (autosplit into blib/lib/auto/RPC/XML/Server/process_request.al) line 1915. ------------------------------------------- I cannot send binary files larger than ~790000 bytes (binary data is sent base64 encoded). I tried to send plain text files too (to avoid base64 encoding). RPC::XML::Server dies on files larger than ~1050000 bytes. How to reproduce: 1. Create Perl script (our server): ==================== CODE ============================== #! /usr/bin/perl use strict; use warnings; use RPC::XML::Server; my $srv = RPC::XML::Server->new(port => 9002); $srv->add_method({ name => 'test', signature => [ 'string' ], code => \&mysub }); $srv->server_loop(); exit; sub mysub { my ($server) = @_; my $in_file = "./test.bin"; open my $IN, '<', $in_file or die "$0 : failed to open input file $in_file : $!\n"; binmode $IN; local $/ = ''; my $context = ''; my $buf; while ( read($IN, $buf, 8 * 2**10) ) { $context .= $buf; } close $IN or warn "$0 : failed to close input file $in_file : $!\n"; my $bindata = new RPC::XML::base64($context); return $bindata; } ==================== END CODE =========================== 2. Place a large file named "test.bin" in the script's directory. 3. Run this script to be a server. 3. Send XML request to this server. RPC::XML::Server will die. Tested with Perl 5.10.1 and RPC::XML::Server version 0.72 and 0.74.
I've attached the test case which contains three files: 1. test_xmlrpc_server_big_data.pl - the script. 2. test_by_curl.sh - shell script to send requests via CURL. 3. test_xmlrpc_server_big_data.xml - XML request which is sent by test_by_curl.sh.
Subject: test_xmlrpc_server_big_data.tar.gz

Message body not shown because it is not plain text.

Subject: Proposed patch
Here is the patch I propose to resolve the problem.
Subject: rpc-xml-server_big-data-crash.patch
--- RPC-XML-0.74/lib/RPC/XML/Server.pm 2011-01-22 23:05:19.000000000 +0200 +++ RPC-XML-0.74_patched/lib/RPC/XML/Server.pm 2011-02-01 15:16:53.478639366 +0200 @@ -73,6 +73,7 @@ use vars qw($VERSION @ISA $INSTANCE $INS use Carp qw(carp croak); use AutoLoader 'AUTOLOAD'; use File::Spec; +use File::Temp; use IO::Handle; use HTTP::Status;
Clearly I don't have any tests that cover this, I can't believe I've had that code in place for this long and never realized that I forgot to load the library! Thank you for the work and the patch, this will go in to the next release. Randy -- """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Randy J. Ray Silicon Valley Scale Modelers: http://www.svsm.org rjray@blackperl.com randy.j.ray@gmail.com
OK, somehow this got forgotten, and has not been put into any of the recent releases. I also still do not have tests to cover this functionality. I will apply the patch now, and it will go out in 0.77. Not sure when I'll get tests in place to cover this, though. Randy -- Randy J. Ray rjray@blackperl.com randy.j.ray@gmail.com