Python: xmlrpc out of memory when sending binary -
i got simple xmlrpc server script written in python. limited memory 512mb simulate environment script running.
import simplexmlrpcserver import resource memory_limit = 512 resource.setrlimit(resource.rlimit_as, (memory_limit * 1048576l, -1l)) class functions: def foo(self, file): print "received file" server = simplexmlrpcserver.simplexmlrpcserver(("localhost", 8000)) server.allow_none = true server.register_instance(functions()) server.serve_forever()
then got client script:
import xmlrpclib import sys client = xmlrpclib.server('http://localhost:8000') file = open(sys.argv[1], 'r') binary = xmlrpclib.binary(file.read()) client.foo(binary)
when send file of 20mb, following exception:
xmlrpclib.fault: <fault 1: "<type 'exceptions.memoryerror'>:">
why can't send 10mb file server has 512mb of memory?
Comments
Post a Comment