Bug 663490 - Using Satellite API to download packages generates a java.lang.OutOfMemoryError: Java heap space
Summary: Using Satellite API to download packages generates a java.lang.OutOfMemoryEr...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: API
Version: 540
Hardware: All
OS: All
urgent
high
Target Milestone: ---
Assignee: Tomas Lestach
QA Contact: Šimon Lukašík
URL:
Whiteboard:
Depends On:
Blocks: sat54-errata
TreeView+ depends on / blocked
 
Reported: 2010-12-15 23:14 UTC by Marcelo Moreira de Mello
Modified: 2018-11-14 16:20 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause packages.getPackage API doesn't have a limit for requested packages Consequence packages.getPackage API fails with OutOfMemoryError when requesting large packages Fix Serving packages according to actual free memory. If a package is too large, throwing PackageDownloadException Result packages.getPackage doesn't fail
Clone Of:
Environment:
Last Closed: 2011-03-17 14:11:18 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
API Python Program (1.63 KB, text/plain)
2010-12-15 23:14 UTC, Marcelo Moreira de Mello
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0362 0 normal SHIPPED_LIVE Red Hat Network Satellite bug fix and enhancement update 2011-03-17 14:10:26 UTC

Description Marcelo Moreira de Mello 2010-12-15 23:14:46 UTC
Created attachment 468990 [details]
API Python Program

Description of problem:
When using Satellite 5.4 API to download packages from a channel, API crashes and show a  java.lang.OutOfMemoryError: Java heap space error. 

   start:
    ---------------------------------------------------
     
    [root@satellite-server rhn-api-00383424]# ./python_createrepo.py
    connect: (satellite-server.FQDN, 80)
    send: 'POST /rpc/api HTTP/1.0\r\nHost: satellite-server.FQDN\r\nUser-Agent: xmlrpclib.py/1.0.1 (by www.pythonware.com)\r\nContent-Type: text/xml\r\nContent-Length: 216\r\n\r\n'
    send: "<?xml version='1.0'?>\n<methodCall>\n<methodName>auth.login</methodName>\n<params>\n<param>\n<value><string>mmello</string></value>\n</param>\n<param>\n<value><string>redhat</string></value>\n</param>\n</params>\n</methodCall>\n"
    reply: 'HTTP/1.1 200 OK\r\n'
    header: Date: Wed, 15 Dec 2010 22:54:40 GMT
    header: Content-Type: text/xml;charset=UTF-8
    header: Content-Length: 172
    header: Set-Cookie: JSESSIONID=13B55E3432358182A836A5CB532E400E; Path=/rhn
    header: Connection: close
    body: '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><string>2097xa35b50f41cabf89c99ab6f06ef930de3</string></value></param></params></methodResponse>'
    connect: (satellite-server.FQDN, 80)
    send: 'POST /rpc/api HTTP/1.0\r\nHost: satellite-server.FQDN\r\nUser-Agent: xmlrpclib.py/1.0.1 (by www.pythonware.com)\r\nContent-Type: text/xml\r\nContent-Length: 283\r\n\r\n'
    send: "<?xml version='1.0'?>\n<methodCall>\n<methodName>channel.software.listAllPackages</methodName>\n<params>\n<param>\n<value><string>2097xa35b50f41cabf89c99ab6f06ef930de3</string></value>\n</param>\n<param>\n<value><string>rhel-x86_64-server-6</string></value>\n</param>\n</params>\n</methodCall>\n"
     
     
    error:
    -------------------------------------------------
    root@satellite-server rhn-api-00383424]# ./python_createrepo.py  > out
    Traceback (most recent call last):
      File "/root/rhn-api-00383424/python_createrepo.py", line 42, in ?
        package = client.packages.getPackage(key,int(i))
      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 1281, in _parse_response
        p.feed(response)
      File "/usr/lib64/python2.4/xmlrpclib.py", line 527, in feed
        self._parser.Parse(data, 0)
    xml.parsers.expat.ExpatError: xml declaration not at start of external entity: line 1, column 84
     
    Downloading: qt-doc-4.6.2-16.el6.noarch.rpm
    connect: (satellite-server.FQDN, 80)
    send: 'POST /rpc/api HTTP/1.0\r\nHost: satellite-server.FQDN\r\nUser-Agent: xmlrpclib.py/1.0.1 (by www.pythonware.com)\r\nContent-Type: text/xml\r\nContent-Length: 249\r\n\r\n'
    send: "<?xml version='1.0'?>\n<methodCall>\n<methodName>packages.getPackage</methodName>\n<params>\n<param>\n<value><string>2098xabe50fd0cf1338d5123b26486e9e2950</string></value>\n</param>\n<param>\n<value><int>16970</int></value>\n</param>\n</params>\n</methodCall>\n"
    reply: 'HTTP/1.1 200 OK\r\n'
    header: Date: Wed, 15 Dec 2010 23:00:41 GMT
    header: Content-Type: text/xml;charset=UTF-8
    header: Content-Length: 385
    header: Set-Cookie: JSESSIONID=2B28D820846608127275B8E913A5C6AF; Path=/rhn
    header: Connection: close
    body: '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><base64><?xml version="1.0" encoding="UTF-8"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>-1</int></value></member><member><name>faultString</name><value><string>java.lang.OutOfMemoryError: Java heap space</string></value></member></struct></value></fault></methodResponse>' 


Version-Release number of selected component (if applicable):
Satellite 5.4

How reproducible:
100%


Steps to Reproduce:
1. Download python_createpo.py attached on BZ
2. Change the crendentials
3. Runs against Satellite 5.4 server
  
Actual results:
<value><struct><member><name>faultCode</name><value><int>-1</int></value></member><member><name>faultString</name><value><string>java.lang.OutOfMemoryError: Java heap space</string></value></member></struct></value></fault></methodResponse>' 

Expected results:
Works as expected

Additional info:

Comment 3 Tomas Lestach 2011-01-05 18:18:11 UTC
This is not a regression bug.
OutOfMemoryError happens, when the package is too large to send over XMLRPC. (Behaves the same on sat53)

A possibility is to increase the JVM heap size - by increasing the -Xmx parameter to 512m in the /etc/tomcat5/tomcat5.conf

Comment 4 Tomas Lestach 2011-01-05 18:22:52 UTC
Identifying, when a package is too large for sending via XMLRPC and throwing a nice exception.

spacewalk.git: 01a9849819ac3afc8039f166dbbfc6d6d7e65edc

Comment 8 Tomas Lestach 2011-02-14 15:26:39 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
packages.getPackage

Consequence
packages.getPackage fails with OutOfMemoryError when requesting large packages

Fix
Serving packages according to actual free memory. If package is too large, throwing PackageDownloadException

Result
packages.getPackage doesn't fail

Comment 9 Tomas Lestach 2011-02-14 17:18:15 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,11 +1,11 @@
 Cause
-packages.getPackage
+packages.getPackage API doesn't have a limit for requested packages
 
 Consequence
-packages.getPackage fails with OutOfMemoryError when requesting large packages
+packages.getPackage API fails with OutOfMemoryError when requesting large packages
 
 Fix
-Serving packages according to actual free memory. If package is too large, throwing PackageDownloadException
+Serving packages according to actual free memory. If a package is too large, throwing PackageDownloadException
 
 Result
 packages.getPackage doesn't fail

Comment 10 Šimon Lukašík 2011-02-24 11:16:44 UTC
Taking QA contact.

Comment 11 Šimon Lukašík 2011-02-25 12:20:47 UTC
Changing to VERIFIED.

Testing procedure:
Automated test

Verified against:
spacewalk-java-1.2.39-37

Comment 12 errata-xmlrpc 2011-03-17 14:11:18 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0362.html


Note You need to log in before you can comment on or make changes to this bug.