Bug 619743

Summary: ssl_example.py fails with MemoryError on ppc64 and s390x
Product: Red Hat Enterprise Linux 6 Reporter: Eduard Benes <ebenes>
Component: python-nssAssignee: John Dennis <jdennis>
Status: CLOSED ERRATA QA Contact: Aleš Mareček <amarecek>
Severity: medium Docs Contact:
Priority: high    
Version: 6.0CC: amarecek, dpal, fnadge, snagar
Target Milestone: rcKeywords: Rebase
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: python-nss-0.11-3.el6 Doc Type: Rebase: Bug Fixes and Enhancements
Doc Text:
This field is the basis of the errata or release note for this bug. It can also be used for change logs. The Technical Note template, known as CCFR, is as follows: Cause What actions or circumstances cause this bug to present. Consequence What happens when the bug presents. Fix What was done to fix the bug.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:35:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 580448, 642407    

Description Eduard Benes 2010-07-30 11:53:14 UTC
Description of problem:
Running ssl_example.py from the python-nss RPM on ppc64 and s390x fails with MemoryError. This works on i386 and x86_64.

<snip>
listening on: 0.0.0.0:1234
client connect from: 10.16.113.7:50803
Traceback (most recent call last):
  File "/usr/share/doc/python-nss-0.8/examples/ssl_example.py", line 352, in <module>
    Server()
  File "/usr/share/doc/python-nss-0.8/examples/ssl_example.py", line 237, in Server
    buf = client_sock.recv(1024)
MemoryError
</snip>

This happens for both io.Socket() and ssl.SSLSocket() in 
/usr/share/doc/python-nss-0.8/examples/ssl_example.py:

 46 import nss.io as io
 47 import nss.nss as nss
 48 import nss.ssl as ssl
 ...
200     if use_ssl:
201         sock = ssl.SSLSocket()
 ...
219     else:
220         sock = io.Socket()
221 
222     # Bind to our network address and listen for clients
223     sock.bind(net_addr)
224     print "listening on: %s" % (net_addr)
225     sock.listen()
226 
227     while True:
228         # Accept a connection from a client
229         client_sock, client_addr = sock.accept()
230         if use_ssl:
231             client_sock.set_handshake_callback(handshake_callback)
232  
  ...
235         while True:
236             # Handle the client connection
237             buf = client_sock.recv(1024)         <<<<<<< MemoryError


Version-Release number of selected component (if applicable):
python-nss-0.8-3.el6.s390x

How reproducible:
always

Steps to Reproduce:
1. Follow instruction in "Getting started" section in file:///usr/share/doc/python-nss-0.8/api/html/index.html
2. Run server side:
  $ python  /usr/share/doc/python-nss-0.8/examples/ssl_example.py -S -d ./pki -n myhost
3. Run client side:
  $ python /usr/share/doc/python-nss-0.8/examples/ssl_example.py -C -d ./pki -n myhost

Alternatively you can use RHTS test /CoreOS/python-nss/Sanity/ssl_example. 

Actual results:
Traceback (most recent call last):
  File "/usr/share/doc/python-nss-0.8/examples/ssl_example.py", line 352, in <module>
    Server()
  File "/usr/share/doc/python-nss-0.8/examples/ssl_example.py", line 237, in Server
    buf = client_sock.recv(1024)
MemoryError

Expected results:
Successful connection and simple message exchange, server received: Hello server, client received: Goodbye.

Additional info:

Comment 22 Florian Nadge 2011-05-10 13:20:46 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:
This field is the basis of the errata or release note for this bug. It can also be used for change logs.

The Technical Note template, known as CCFR, is as follows:

Cause
    What actions or circumstances cause this bug to present.
Consequence
    What happens when the bug presents.
Fix
    What was done to fix the bug.

Comment 23 John Dennis 2011-05-10 16:21:09 UTC
Cause:

CPython modules (Python written in C) use object reference counting to control the lifetime of an object. Some code sequences would cause the object reference count to be computed incorrectly causing an object to be released too soon resulting in a memory error.

Consequence:

A Python "memory error" exception is raised.

Fix:

Internal reference counting logic corrected.

Result:

Memory errors and other anomalies eliminated.

Comment 24 errata-xmlrpc 2011-05-19 13:35: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-0607.html