By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,907 Members | 1,832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,907 IT Pros & Developers. It's quick & easy.

M2Crypto-0.17 blocks python threads?

P: n/a
I am having a problem with python threads and M2Crypto. It appears
the M2Crypto used in multi-thread application blocks other threads
from running:

Environment: Linux 2.6 (centos 5.0), OpenSSL 0.9.8b, M2Crypto-0.17

I am using echod-thread.py and echo.py as test vehicles.

Start up echod-thread.py
Connect with echo.py - everything looks ok, but connect with second
echo.py and notice that the server does not respond until after the
first echo session is terminated. And yes, echod-thread.py does call
M2Crypto.threading.init()

So my questions are has anyone seen this kind of threading behavior?
If so how did you fix it?

(NOTE: This used to work with old M2Crytpo-0.13)

I edited a version of the server to print some debug messages. Around
the main server loop:

while 1:
print "#### waiting for connection on port 9999"
conn, addr = sock.accept()
thread.start_new_thread(echo_handler, (ctx, conn, addr))
print "#### started thread, main thread sleeping for 2
seconds"
time.sleep(2) # give first session time to start

[tablus@belgrade ssl]$ python echod-thread.py
#### waiting for connection on port 9999
#### started thread, main thread sleeping for 2 seconds
<NOTE: main thread does not continue until thread started with first
echo session terminates!>

< first echo session thread -- works ok>
[tablus@belgrade ssl]$ python echo.py -h belgrade.tablus.com
LOOP: SSL connect: before/connect initialization
LOOP: SSL connect: SSLv3 write client hello A
LOOP: SSL connect: SSLv3 read server hello A
LOOP: SSL connect: SSLv3 read server certificate A
LOOP: SSL connect: SSLv3 read server key exchange A
LOOP: SSL connect: SSLv3 read server done A
LOOP: SSL connect: SSLv3 write client key exchange A
LOOP: SSL connect: SSLv3 write change cipher spec A
LOOP: SSL connect: SSLv3 write finished A
LOOP: SSL connect: SSLv3 flush data
LOOP: SSL connect: SSLv3 read finished A
INFO: SSL connect: SSL negotiation finished successfully
Host = belgrade.tablus.com
Cipher = DHE-RSA-AES256-SHA
Server = /CN=belgrade.tablus.com/ST=CA/C=US/
em**********************@tablus.com/O=Root Certification Authority
Ye Newe Threading Echo Servre
Echo this
Echo this

< second echo session thread -- hangs waiting for server to respond
until first session exits>
[tablus@belgrade ssl]$ python echo.py -h belgrade.tablus.com
LOOP: SSL connect: before/connect initialization
LOOP: SSL connect: SSLv3 write client hello A

Jun 1 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
re****@gmail.com wrote:
I am having a problem with python threads and M2Crypto. It appears
the M2Crypto used in multi-thread application blocks other threads
from running:
This turned into https://bugzilla.osafoundation.org/show_bug.cgi?id=9401

Thanks for the report!

--
Heikki Toivonen
Jun 2 '07 #2

P: n/a
Heikki Toivonen wrote:
re****@gmail.com wrote:
>>I am having a problem with python threads and M2Crypto. It appears
the M2Crypto used in multi-thread application blocks other threads
from running:


This turned into https://bugzilla.osafoundation.org/show_bug.cgi?id=9401

Thanks for the report!
That helps. I've been getting occasional stalls and timeouts in
a multithreaded program that can have several M2Crypto operations
going, and this is probably the explaination.

John Nagle
Jun 3 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.