472,993 Members | 2,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 software developers and data experts.

M2Crypto-0.17 blocks python threads?

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
2 2133
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hallvard B Furuseth | last post by:
Does anyone know how I check the server certificate with M2Crypto? Currently a program I have inherited does this: #!/local/bin/python2.2 import xmlrpclib from M2Crypto.m2xmlrpclib import...
5
by: jsmilan | last post by:
Hi, all; I'm strictly an amateur developer who has dabbled in a half dozen languages on eight or nine systems over 20 years or so. I have never devoted the time or energy to thoroughly learn...
2
by: Elbert Lev | last post by:
People! Have somebody build M2Crypto for 2.4 on windows? If yes, please tell if there are any problems.
0
by: Ola Natvig | last post by:
Hi all I'm writing a SSL server and we are using M2Crypto as our SSL engine. What bothers me is that on every accept it prints a lot of 'junk-data' to my stdout. It would be nice if someone knew...
1
by: morphex | last post by:
Hi, I get the following messages running the testall.py script with m2crypto 0.13, can anyone tell me what's wrong? .................................................................EEEEEE...
5
by: KW | last post by:
I'm trying to convert some PHP code using OpenSSL to Python and I'm stuck on openssl_sign() which uses an RSA private key to compute a signature. Example PHP code: $privkeyid =...
0
by: Croteam | last post by:
Hello, I was install M2Crypto-0.17beta1.win32-py2.4,and when I run it, I get the error: Traceback (most recent call last): File "<pyshell#0>", line 1, in -toplevel- import M2Crypto
8
by: John Nagle | last post by:
I've been running M2Crypto successfully using Python 2.4 on Windows 2000, and now I'm trying to get it to work on Python 2.3.4 on Linux. Attempting to initialize a context results in Traceback...
10
by: John Nagle | last post by:
Here are three network-related exceptions. These were caught by "except" with no exception type, because none of the more specific exceptions matched. This is what a traceback produced: 1....
7
by: John Nagle | last post by:
Back in March, I posted this: That was for M2Crypto 0.17. It's still broken in M2Crypto 0.18. And there's no RPM or Windows binary. Nobody actually uses this stuff, do they?
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.