Skip to content

Commit 3987fd6

Browse files
author
Ralf Schlatterbeck
committed
Fix bug with SSL-connection and XMLRPC...
...see my monologue at http://thread.gmane.org/gmane.comp.bug-tracking.roundup.user/9700 This also fixes a race condition where the forked roundup process would consume 99% CPU resources after the client opens the SSL connection but doesn't send anything, e.g., s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('localhost', 443)) ssl_sock = socket.ssl(s)
1 parent a641a62 commit 3987fd6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

roundup/scripts/roundup_server.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
except ImportError:
3030
SSL = None
3131

32+
from time import sleep
33+
3234
# python version check
3335
from roundup import configuration, version_check
3436
from roundup import __version__ as roundup_version
@@ -127,9 +129,18 @@ def readline(self, *args):
127129
try:
128130
line = self.__fileobj.readline(*args)
129131
except SSL.WantReadError:
132+
sleep (.1)
130133
line = None
131134
return line
132135

136+
def read(self, *args):
137+
""" SSL.Connection can return WantRead """
138+
while True:
139+
try:
140+
return self.__fileobj.read(*args)
141+
except SSL.WantReadError:
142+
sleep (.1)
143+
133144
def __getattr__(self, attrib):
134145
return getattr(self.__fileobj, attrib)
135146

0 commit comments

Comments
 (0)