[mod_python] SSL Socket Problem

Huzaifa Tapal huzaifa at hostway.com
Wed Apr 27 15:27:45 EDT 2005

Hello Dan,

I have been doing some research and we checked tcpdump and netstats 
while the error is happening and there are no socket connections open.  
Is there a thread safety issue in httplib and socket?  What concerns me 
is that the ssl() method in socket.py is at the global level meaning 
that the somehow the sockets are being changed by multiple threads.


Dan Nelson wrote:

> If it's working for a while and then you get an error, perhaps it has 
> something to do with apache reaching some limit, queueing/caching, too 
> many threads, too many sockets...  That might be a place to start 
> looking.
> Dan
> ----- Original Message ----- From: "Huzaifa Tapal" <huzaifa at hostway.com>
> To: <mod_python at modpython.org>
> Sent: Thursday, 21 April, 2005 2:56 AM
> Subject: [mod_python] SSL Socket Problem
>> Hello All,
>> I am having a problem with making SSL socket connections in my 
>> mod_python application running with python 2.3.5.  The error I keep 
>> getting back is "TypeError: ssl() argument 1 must be _socket.socket, 
>> not _socketobject". What is odd is that if I restart the apache2 web 
>> server, the error goes away and all the calls return back with a 
>> message.  However, after about 20 or so minutes we start getting this 
>> error almost instantaneously without any kind of message going out at 
>> all.
>> Here is the full traceback:
>>         con.endheaders()
>>        File "/usr/lib/python2.3/httplib.py", line 715, in endheaders
>>         self._send_output()
>>        File "/usr/lib/python2.3/httplib.py", line 600, in _send_output
>>         self.send(msg)
>>        File "/usr/lib/python2.3/httplib.py", line 567, in send
>>         self.connect()
>>        File "/usr/lib/python2.3/httplib.py", line 988, in connect
>>         ssl = socket.ssl(sock, self.key_file, self.cert_file)
>>        File "/usr/lib/python2.3/socket.py", line 73, in ssl
>>         return _realssl(sock, keyfile, certfile)
>>     TypeError: ssl() argument 1 must be _socket.socket, not 
>> _socketobject
>> I have the same application running on another machine with python 
>> 2.3.4 and I can't replicate it in there.  Do you guys know of any 
>> known issues with sockets and ssl with python 2.3.5?
>> Any help would be appreciated.
>> Hozi
>> _______________________________________________
>> Mod_python mailing list
>> Mod_python at modpython.org
>> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list