Hi,

I saw some work to make the connection timeout configurable for the proxy and 
yum-plugin-spacewalk.
Also the server uses the rpclib. I saw similar problems using satellite-sync, 
so I created a patch which introduce a timeout variable in rhn_server.conf

-- 
Regards

        Michael Calmer

--------------------------------------------------------------------------
Michael Calmer
SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuernberg
T: +49 (0) 911 74053 0
F: +49 (0) 911 74053575  - e-mail: michael.cal...@suse.com
--------------------------------------------------------------------------
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer
HRB 16746 (AG Nürnberg)
>From 9e8cfaaf8e98e5254b2f475fd3d126bc5b7173e8 Mon Sep 17 00:00:00 2001
From: Michael Calmer <m...@suse.de>
Date: Mon, 22 Apr 2013 16:58:03 +0200
Subject: [PATCH] make rpclib connection timeout configurable

---
 backend/rhn-conf/rhn_server.conf                  |  3 +++
 backend/satellite_tools/connection.py             | 11 +++++++----
 backend/satellite_tools/rhn_satellite_activate.py |  3 ++-
 backend/satellite_tools/xmlWireSource.py          |  4 ++--
 backend/spacewalk-backend.spec                    |  6 +++---
 5 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/backend/rhn-conf/rhn_server.conf b/backend/rhn-conf/rhn_server.conf
index c3ce9c1..4f9e313 100644
--- a/backend/rhn-conf/rhn_server.conf
+++ b/backend/rhn-conf/rhn_server.conf
@@ -26,6 +26,9 @@ client_auth_timeout = 3600.0
 # 6 hours
 proxy_auth_timeout = 21600.0
 
+# rpclib connection timeout
+timeout = 120
+
 # Directory location of cached packages lists. (Created automatically)
 pkg_list_dir = /var/up2date/list
 
diff --git a/backend/satellite_tools/connection.py b/backend/satellite_tools/connection.py
index 394874a..45a8c50 100644
--- a/backend/satellite_tools/connection.py
+++ b/backend/satellite_tools/connection.py
@@ -87,9 +87,10 @@ class _Server(rpclib.Server):
 
 class StreamConnection(_Server):
     def __init__(self, uri, proxy=None, username=None, password=None, 
-                refreshCallback=None, xml_dump_version=constants.PROTOCOL_VERSION):
+                refreshCallback=None, xml_dump_version=constants.PROTOCOL_VERSION,
+                timeout=None):
         _Server.__init__(self, uri, proxy=proxy, username=username,
-                password=password, refreshCallback=refreshCallback)
+                password=password, refreshCallback=refreshCallback, timeout=timeout)
         self.add_header("X-RHN-Satellite-XML-Dump-Version", xml_dump_version)
 
 class GETServer(rpclib.GETServer):
@@ -100,7 +101,8 @@ class GETServer(rpclib.GETServer):
     _transport_class_https_proxy = SafeProxyTransport
     def __init__(self, uri, transport=None, proxy=None, username=None,
             password=None, client_version=2, headers={}, refreshCallback=None,
-            progressCallback=None, xml_dump_version=constants.PROTOCOL_VERSION):
+            progressCallback=None, xml_dump_version=constants.PROTOCOL_VERSION,
+            timeout=None):
         rpclib.GETServer.__init__(self, uri,
             transport=transport,
             proxy=proxy,
@@ -108,7 +110,8 @@ class GETServer(rpclib.GETServer):
             password=password,
             client_version=client_version,
             headers=headers,
-            refreshCallback=refreshCallback)
+            refreshCallback=refreshCallback,
+            timeout=timeout)
         self.add_header("X-RHN-Satellite-XML-Dump-Version", xml_dump_version)
 
 class CompressedStream:
diff --git a/backend/satellite_tools/rhn_satellite_activate.py b/backend/satellite_tools/rhn_satellite_activate.py
index 73f57c0..c753dcc 100644
--- a/backend/satellite_tools/rhn_satellite_activate.py
+++ b/backend/satellite_tools/rhn_satellite_activate.py
@@ -89,7 +89,8 @@ def getXmlrpcServer(server, handler, proxy, proxyUser, proxyPass,
         uri = 'http://' + _uri
 
     s = rpclib.Server(uri, refreshCallback=None,
-                         proxy=proxy, username=proxyUser, password=proxyPass)
+                         proxy=proxy, username=proxyUser, password=proxyPass,
+                         timeout=CFG.timeout)
     if sslYN and sslCertPath:
         if not os.access(sslCertPath, os.R_OK):
             sys.stderr.write("SSL CA Cert inaccessible: '%s'\n" % sslCertPath)
diff --git a/backend/satellite_tools/xmlWireSource.py b/backend/satellite_tools/xmlWireSource.py
index c46b357..8e95f71 100644
--- a/backend/satellite_tools/xmlWireSource.py
+++ b/backend/satellite_tools/xmlWireSource.py
@@ -106,7 +106,7 @@ class BaseWireSource:
         
         serverObj = connection.StreamConnection(url, proxy=CFG.HTTP_PROXY, 
             username=CFG.HTTP_PROXY_USERNAME, password=CFG.HTTP_PROXY_PASSWORD,
-            xml_dump_version=self.xml_dump_version)
+            xml_dump_version=self.xml_dump_version, timeout=CFG.timeout)
         BaseWireSource.serverObj = serverObj
         return serverObj
 
@@ -363,7 +363,7 @@ class RPCGetWireSource(BaseWireSource):
         url = self.url + self.handler
         get_server_obj = connection.GETServer(url, proxy=CFG.HTTP_PROXY,
             username=CFG.HTTP_PROXY_USERNAME, password=CFG.HTTP_PROXY_PASSWORD,
-            headers=self.login_token)
+            headers=self.login_token, timeout=CFG.timeout)
         # Add SSL trusted cert
         self._set_ssl_trusted_certs(get_server_obj)
         self._set_rpc_server(get_server_obj)
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 1981fc2..309ed11 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -21,7 +21,7 @@ BuildArch: noarch
 Requires: python, rpm-python
 # /etc/rhn is provided by spacewalk-proxy-common or by spacewalk-config
 Requires: /etc/rhn
-Requires: rhnlib >= 2.5.35
+Requires: rhnlib >= 2.5.57
 # for Debian support
 Requires: python-debian
 Requires: %{name}-libs >= 1.1.16-1
@@ -30,7 +30,7 @@ BuildRequires: /usr/bin/docbook2man
 BuildRequires: docbook-utils
 %if 0%{?fedora} > 15 || 0%{?rhel} > 5
 BuildRequires: spacewalk-pylint
-BuildRequires: rhnlib >= 2.5.35
+BuildRequires: rhnlib >= 2.5.57
 BuildRequires: rpm-python
 BuildRequires: python-crypto
 BuildRequires: python-debian
@@ -244,7 +244,7 @@ Requires: python-hashlib
 Requires: mod_ssl
 Requires: %{name}-xml-export-libs
 Requires: cobbler >= 2.0.0
-Requires: rhnlib  >= 2.5.35
+Requires: rhnlib  >= 2.5.57
 Obsoletes: rhns-satellite-tools < 5.3.0
 Obsoletes: spacewalk-backend-satellite-tools <= 0.2.7
 Provides: spacewalk-backend-satellite-tools = %{version}-%{release}
-- 
1.8.2

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to