<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=Big5" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Joe Wong wrote:<br>
<blockquote
 cite="mid027501c48680$950cb3b0$7f00a8c0@scl01.siliconcreation.com"
 type="cite">
  <meta http-equiv="Context-Type" content="text/html; charset=big5">
  <div> Hi, </div>
  <div>  </div>
  <div>  I have a small program using HTTPSConnection to issue a POST
on the server. When multiple threads of the same program is running, I
got the error: </div>
  <div>  </div>
  <div> Exception in thread Thread-3:<br>
Traceback (most recent call last):<br>
  File "C:\PYTHON23\lib\threading.py", line 436, in __bootstrap<br>
    self.run()<br>
  File "C:\PYTHON23\lib\threading.py", line 416, in run<br>
    self.__target(*self.__args, **self.__kwargs)<br>
  File "mcstest.py", line 27, in thread_func<br>
    conn.request("POST", CGI_PATH, params, headers)<br>
  File "c:\python23\lib\httplib.py", line 718, in request<br>
    self._send_request(method, url, body, headers)<br>
  File "c:\python23\lib\httplib.py", line 739, in _send_request<br>
    self.endheaders()<br>
  File "c:\python23\lib\httplib.py", line 712, in endheaders<br>
    self._send_output()<br>
  File "c:\python23\lib\httplib.py", line 597, in _send_output<br>
    self.send(msg)<br>
  File "c:\python23\lib\httplib.py", line 564, in send<br>
    self.connect()<br>
  File "c:\python23\lib\httplib.py", line 985, in connect<br>
    ssl = socket.ssl(sock, self.key_file, self.cert_file)<br>
  File "C:\Python23\lib\socket.py", line 73, in ssl<br>
    return _realssl(sock, keyfile, certfile)<br>
sslerror: SSL_CTX_new error </div>
  <div>  </div>
  <div> in random order. Is there any fix / patches for this? </div>
  <div>  </div>
  <div> Regards, </div>
  <div>  </div>
  <div> - Joe </div>
  <div> </div>
</blockquote>
Are you passing the same HTTPSConnection object to a bunch of threads? 
With just a cursory glance at the httplib module, it doesn't look like
it is thread safe (meaning I saw no thread imports, no references to
locks, etc.).  If, for some reason, you feel it necessary to pass the
same HTTPSConnection object to multiple threads, you will probably want
to write a thread-safe wrapper for HTTPSConnection.  I can't think why
you would want to pass the same conn object to multiple threads rather
than creating a new one per thread - unless you want to have one and
only one persistent connection among all threads (using keepalives, I
guess).<br>
<br>
<br>
Jeremy<br>
</body>
</html>