RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1195446 - python-rhsm sets socket.setdefaulttimeout(60) _always_
Summary: python-rhsm sets socket.setdefaulttimeout(60) _always_
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python-rhsm
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: candlepin-bugs
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel68
TreeView+ depends on / blocked
 
Reported: 2015-02-23 21:03 UTC by Adrian Likins
Modified: 2015-11-19 11:48 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 11:48:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2122 0 normal SHIPPED_LIVE subscription-manager bug fix and enhancement update 2015-11-19 10:31:14 UTC

Description Adrian Likins 2015-02-23 21:03:04 UTC
Description of problem:
See https://github.com/candlepin/subscription-manager/issues/1006 for
upstream report.

python-rhsm always sets socket.defaulttimeout(60), which applies to
any process that imports the module (like yum via subscription-manager plugin). It was meant to only do this for RHEL5 (reluctantly...) where it is the only
option to set socket timeouts (python 2.3) but accidently does it on any python 2.X version (RHEL5/6/7)

in rhsm/connection.py, the line:

   if sys.version_info[0] == 2 and sys.version_info[0] <= 4:
      socket.setdefaulttimeout(60)

should be:

    if sys.version_info[0] == 2 and sys.version_info[1] <= 4:
       socket.setdefaulttimeout(60)


Regardless of version, setting the defaulttimeout is almost certainly wrong,
and should be replaced with per socket timeouts (newer pythons) or other mechanisms to detect timeouts  (event loops and watchdog timers, etc)

Version-Release number of selected component (if applicable):
Since python-rhsm-1.0.4-1

How reproducible:
See upstream bug report, but 'always'.



Expected results:
The default socket timeout to only be changed on RHEL5 and python 2.3, and
probably not even then.


Additional info:

Comment 1 Adrian Likins 2015-02-23 21:05:56 UTC
Original change of default timeout was as fix for
https://bugzilla.redhat.com/show_bug.cgi?id=834108

Comment 2 Adrian Likins 2015-02-23 23:02:04 UTC
pr at https://github.com/candlepin/python-rhsm/pull/144

Comment 3 Chris "Ceiu" Rog 2015-06-22 18:19:09 UTC
Commit: a974e5d636009fa41bec2b4a9d33f853e9e72a2b

Comment 5 John Sefler 2015-07-23 21:10:58 UTC
Demonstrating the failure on RHEL7.1, python-rhsm version...
[root@jsefler-71 ~]# rpm -q python-rhsm python
python-rhsm-1.13.10-1.el7.x86_64
python-2.7.5-16.el7.x86_64
[root@jsefler-71 ~]# cat /usr/local/bin/socketgetdefaulttimeouttest.py
import socket
import yum
yb = yum.YumBase()
print socket.getdefaulttimeout()
yb.getReposFromConfig()
print socket.getdefaulttimeout()
[root@jsefler-71 ~]# python /usr/local/bin/socketgetdefaulttimeouttest.py
None
Loaded plugins: langpacks, product-id
60.0
[root@jsefler-71 ~]# 

^^^^ Notice the value 60.0 



Verifying RHEL7.2, python-rhsm version...
[root@jsefler-72 ~]# rpm -q python-rhsm python
python-rhsm-1.15.3-1.el7.x86_64
python-2.7.5-30.el7.x86_64
[root@jsefler-72 ~]# cat /usr/local/bin/socketgetdefaulttimeouttest.py
import socket
import yum
yb = yum.YumBase()
print socket.getdefaulttimeout()
yb.getReposFromConfig()
print socket.getdefaulttimeout()
[root@jsefler-72 ~]# python /usr/local/bin/socketgetdefaulttimeouttest.py
None
Loaded plugins: langpacks, product-id
None
[root@jsefler-72 ~]# 

^^^^ VERIFIED: the second None value indicates that a default timeout value is no longer being set when run on python 2.7

Comment 6 errata-xmlrpc 2015-11-19 11:48:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2122.html


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