Search code examples
pythonsslcentosgevent

centos 7.2 python 2.7.5 WSGIServer can't deliver keyfile argument


experts.

I'm making a python server using ssl. So, I'm using gevent.pywsgi.WSGIServer. But when I try to deliver keyfile.. that is not deliver to _ssl.c which is c library for python.

My code is below..

rack.append(WSGIServer(('', conf.ssl_port), application, backlog=2500,  
                    keyfile=conf.keyfile, certfile=conf.certfile))  

Surely, keyfile has proper values. but when this is reached at _ssl.c's code

load_cert_chain_args

on that function's PyString_Check for keyfile argumnet makes segmentation fault. (You can confirm /Python-2.7.5/Module/_ssl.c + 2695 line).

when i confirm load_cert_chain_args' keyfile arg, I can see this log.

keyfile=keyfile@entry=(unknown at remote 0xd231d4)

but when I confirm this memory's value.

x/s 0xd231d4L : "correct string is in here"

I don't know why this make.. though in memory there is proper value about keyfile.

if this is pagetable issue.. maybe i can't see the keyfile value using gdb.

but i don't know why _ssl.c's load_cert_chain makes Segmemtation fault (PyString_Check(keyfile)).

and I don't know although i can see the value in memory why gdb remains unknow at remote log.

I'm using Python 2.7.5 on Centos 7 and using python-gevent 1.0-2.el7).

Thx.


Solution

  • Finally I find the answer.

    when i used Python 2.7.5-34 which is installed in CentOS 7.2,

    that deliver pure string not as PyObject to _ssl.c python c module.

    for soliving my problem, below link is really helpful.

    https://github.com/gevent/gevent/issues/702

    Thanks!