473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 2152
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?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.