Bug 128727 - (IT:45323) python httplib.HTTPSConnection not thread safe
python httplib.HTTPSConnection not thread safe
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: python (Show other bugs)
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Mihai Ibanescu
: 121428 (view as bug list)
Depends On:
Blocks: 123574
  Show dependency treegraph
Reported: 2004-07-28 14:48 EDT by Brian Long
Modified: 2007-11-30 17:07 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-12-21 20:51:25 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
httplib.HTTPConnection script (660 bytes, text/plain)
2004-07-28 14:49 EDT, Brian Long
no flags Details
httplib.HTTPSConnection script (661 bytes, text/plain)
2004-07-28 14:51 EDT, Brian Long
no flags Details
backport ssl thread support from python 2.3.3 (2.08 KB, patch)
2004-10-05 01:43 EDT, Don Howard
no flags Details | Diff

  None (edit)
Description Brian Long 2004-07-28 14:48:14 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040204

Description of problem:
Simple threaded python script breaks when httplib.HTTPSConnection is
used.  httplib.HTTPConnection works fine in the same scenario.  It is
unclear if this is a httplib issue or a openssl bindings issue.

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

How reproducible:

Steps to Reproduce:
1. Start netcat "nc -l -p 8080".
2. Run python-https.py on same host.


Actual Results:  When httplib.HTTPConnection is called, "I'm still
here" prints on the screen every 2 seconds.  When
httplib.HTTPSConnection is called, "I'm still here" prints once and
then the script bombs (and the output on the netcat window is screwed up).

Expected Results:  When httplib.HTTPSConnection is called, "I'm still
here" should print every 2 seconds just like when using

Additional info:

python 2.3 on Fedora Core 2 does NOT have this issue.  Whatever
changed in python 2.3 (or openssl) on FC2 should be back-ported to
RHEL 3 to fix this issue.
Comment 1 Brian Long 2004-07-28 14:49:43 EDT
Created attachment 102260 [details]
httplib.HTTPConnection script

This script works in conjunction with "nc -l -p 8080" using the HTTP protocol.
Comment 2 Brian Long 2004-07-28 14:51:02 EDT
Created attachment 102261 [details]
httplib.HTTPSConnection script

This script fails in conjunction with "nc -l -p 8080".	The only difference
between this script and python-http.py is the httplib.HTTPConnection was
changed to httplib.HTTPSConnection.
Comment 3 Steve Conklin 2004-08-02 16:29:54 EDT
Comment 4 Mihai Ibanescu 2004-08-04 12:48:25 EDT
I'd be interested to see if this happens with rhnlib as well.
python's stock ssl implementation is pretty useless, that's why RHN
uses pyOpenSSL (binding directly to openssl). I'll modify the test
case for that.
Comment 8 Don Howard 2004-10-01 19:54:33 EDT
I've been looking at this ticket this afternoon, and I've noticed 
that the "I'm still here thread" appears to block on a futex after 
the network thread opens it's ssl connection.  In the non-ssl case, 
the "ISH" thread does not block on the futex.  The network thread 
appears to be doing the same number/order of futex wakes.  
I'm looking for the source (and backtrace) of the futex calls.. 
Comment 9 Don Howard 2004-10-05 01:43:51 EDT
Created attachment 104770 [details]
backport ssl thread support from python 2.3.3
Comment 10 Don Howard 2004-10-05 01:46:22 EDT
The above patch corrects the hang reported in this ticket. 
Needs review by someone who understands phython's threading/locking 
Comment 11 Mihai Ibanescu 2004-10-05 08:09:01 EDT
The patch looks harmless. Thanks for submitting it, I'll build a new
python package.
Comment 12 Brian Long 2004-10-05 20:54:54 EDT
Can you please release this RPM as an errata for RHEL 3?  If possible,
releasing it before Update 4 would be ideal; otherwise, please include
it in Update 4.  Thank you.
Comment 13 Steve Conklin 2004-10-26 15:28:59 EDT
Did this make the U4 beta?
Comment 14 Mihai Ibanescu 2004-10-26 15:55:55 EDT
No, looks like I missed the deadline. I'll build the packages
nevertheless and put them on people.redhat.com in the meantime.
Comment 15 Mihai Ibanescu 2004-10-26 18:06:01 EDT
Packages are now available at:

The packages are signed with my GPG key, available at:
Comment 18 Brian Long 2004-10-27 08:46:33 EDT
It was my understanding from IBM Level 3 support that this package
would be in U4.  Is there any chance this package can be added to the
U4 beta in RHN so people can test it until U4 is GA?
Comment 19 Mihai Ibanescu 2004-10-27 10:07:16 EDT

We are currently working with Release Engineering and QA on a plan to
put this package in U4. As far as I know U4 beta is frozen, but we
will see what we can do to make them widely available. In the
meantime, if you can try to run the packages posted on comment #15 in
one of your environments that are exhibiting the problem, that would
give me a higher level of confidence that the problem is indeed fixed.
Comment 20 Brian Long 2004-10-27 11:08:53 EDT

The problem is fixed with your RPM.  That's why I'm hoping it shows up
in U4  :)  Thanks!

Comment 21 Mihai Ibanescu 2004-10-28 16:56:30 EDT
Brian, it's great to hear that! Major problems raised by QA excluded,
it should make it in U4.
Comment 22 John Flanagan 2004-12-21 20:51:25 EST
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 the 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.

Comment 23 Ray Strode [halfline] 2005-05-10 14:08:25 EDT
*** Bug 121428 has been marked as a duplicate of this bug. ***

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