Re: m2crypto blocking all other threads

Heikki Toivonen <[email protected]>
Newsgroups gmane.comp.python.cryptography
Message-ID <[email protected]>
Rune Froysa wrote:
> I'm using m2crypto for a SSL-based xmlrpc service.  This service is
> frequently DOSed by what appears to be a bug in m2crypto: it blocks

It seems like this is user error. In a multithreaded application you
need to initialize M2Crypto for threading. With those changes your
sample works for me. See below:

> #!/usr/bin/env python
> import sys, time, threading

from M2Crypto import threading as m2threading

> demo_dir='/tmp/m2crypto-0.15/demo/ssl'
> sys.path.insert(0, demo_dir)
> 
> from https_srv import *
> 
> def my_wt():
>     while True:
>         time.sleep(0.5)
>         print "test"
> 
> if __name__ == '__main__':

      m2threading.init()

>     threading.Thread(target=my_wt).start()
>     ctx = init_context('sslv23', '%s/server.pem' % demo_dir, '%s/ca.pem' % demo_dir, 
>                        SSL.verify_none)
>     httpsd = HTTPS_Server(('', 9443), HTTP_Handler, ctx)
>     httpsd.serve_forever()

      m2threading.cleanup()



> BTW: under 0.15, the https_srv.py complains from line 126 -> SSL/Context.py: 118:
> TypeError: ssl_ctx_load_verify_locations() argument 3 must be string, not None

This does not happen for me.


Please note that I did find a bug in Connection.py regarding handling of
post connection checks and just fixed them.

-- 
  Heikki Toivonen
signature.asc (application/pgp-signature, 253 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD4DBQFDMjhkb8x8KoP+JuwRAlsxAJjo4Ho+OphMbxZd0A0FtOB4ilecAKC2ihyI
4TcaJ00ykMFl0OLrvyIIcw==
=lKll
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.