| Summary: | API or API documentation for packages.getPackage is incorrect | ||
|---|---|---|---|
| Product: | Red Hat Satellite 5 | Reporter: | Raul Mahiques <rmahique> |
| Component: | API | Assignee: | Tomas Lestach <tlestach> |
| Status: | CLOSED NOTABUG | QA Contact: | Red Hat Satellite QA List <satqe-list> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 540 | CC: | cperry, mmello |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2011-08-15 13:09:20 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Bug Depends On: | |||
| Bug Blocks: | 462714 | ||
CORRECTION: THE FOLLOWING PART BELONGS TO ANOTHER BUG, PLEASE IGNORE IT When dowloading a package (rather big) from the Satellite server using client.packages.getPackage(key, id), the method raises an Exception: 2011-06-14T14:58:07: Exporting 19 packages from layer 'o-basisinfra-x86_64-2011_1__o-rhel5-x86_64-2011_1' Traceback (most recent call last): File "satak.py", line 113, in ? l2.Export(jieh, output_handler = oh, satellite_connection = con) File "/home/bergs08/workspace/sat_import-export/sat/satobj.py", line 1247, in Export package_data = con.packages.getPackage(key, package_details['id']) File "/usr/lib64/python2.4/xmlrpclib.py", line 1096, in __call__ return self.__send(self.__name, args) File "/usr/lib64/python2.4/xmlrpclib.py", line 1383, in __request verbose=self.__verbose File "/usr/lib64/python2.4/xmlrpclib.py", line 1147, in request return self._parse_response(h.getfile(), sock) File "/usr/lib64/python2.4/xmlrpclib.py", line 1286, in _parse_response return u.close() File "/usr/lib64/python2.4/xmlrpclib.py", line 744, in close raise Fault(**self._stack[0]) xmlrpclib.Fault: <Fault 2302: 'redstone.xmlrpc.XmlRpcFault: The requested file is too large to download over XMLRPC.'> It is not documentated that this method can raise an exception. Hello, In the errata http://rhn.redhat.com/errata/RHBA-2011-0362.html actually the package maintainer added code to returning the following message: "The requested file is too large to download over XMLRPC." (api.package.download.toolarge) for the problem with "java.lang.OutOfMemoryError: Java heap space" every time the requested file is greater than actual free space of java virtual machine processing the request, that is why it even fails on 1.5M binary. The patch only returns better error message and prevents sending the OutOfMemoryError. If you still faced with the "..too large to download over XMLRPC" error, then you have to set the JAVA_OPTS's '-Xmx' parameter in /etc/tomcat5/tomcat5.conf to a higher value. If you already set it to 512m, then you have to increase it to 768m/1000m (or more if the problem persists). Since some packages can be bigger than the amount of free RAM at Tomcat's heap, in this situation it is really better to use the packages.getPackageUrl() instead of packages.getPackage(), because downloading the file directly using the url returned by getPackageUrl() circumvents the memory restrictions put on java processes returning the file over xmlrpc and downloads the file directly (internally by simply redirecting the apache to it). getPackageUrl() is the expected method to download packages through API for larger packages. We have documented this information as a public kbase article, please see https://access.redhat.com/kb/docs/DOC-59899 Since it's not a bug, we are closing this bugzilla. Cheers, Marcelo Moreira de Mello |
When dowloading a package (rather big) from the Satellite server using client.packages.getPackage(key, id), the method raises an Exception: 2011-06-14T14:58:07: Exporting 19 packages from layer 'o-basisinfra-x86_64-2011_1__o-rhel5-x86_64-2011_1' Traceback (most recent call last): File "satak.py", line 113, in ? l2.Export(jieh, output_handler = oh, satellite_connection = con) File "/home/bergs08/workspace/sat_import-export/sat/satobj.py", line 1247, in Export package_data = con.packages.getPackage(key, package_details['id']) File "/usr/lib64/python2.4/xmlrpclib.py", line 1096, in __call__ return self.__send(self.__name, args) File "/usr/lib64/python2.4/xmlrpclib.py", line 1383, in __request verbose=self.__verbose File "/usr/lib64/python2.4/xmlrpclib.py", line 1147, in request return self._parse_response(h.getfile(), sock) File "/usr/lib64/python2.4/xmlrpclib.py", line 1286, in _parse_response return u.close() File "/usr/lib64/python2.4/xmlrpclib.py", line 744, in close raise Fault(**self._stack[0]) xmlrpclib.Fault: <Fault 2302: 'redstone.xmlrpc.XmlRpcFault: The requested file is too large to download over XMLRPC.'> It is not documentated that this method can raise an exception. The value returned is not encoded in base64 as the documentation says. Example: package_data = con.packages.getPackage(key, package_details['id']) # Here is the base64 encoded package. Decode it and store the # package print package_data.__class__.__name__ f=open('/tmp/the_file', 'w') f.write(package_data.data) f.close()