Importing pyfmi under Apache/wsgi goes to infinite loop

1 post / 0 new
cboudinet
Offline
Joined: 2018-04-05
Importing pyfmi under Apache/wsgi goes to infinite loop

Hello

I installed pyfmi on a debian 9 64 machine and I am trying to import pyfmi in python module import by apache http server.

The problem is that when I import pyfmi from my wsgi script, the import never ends. It seems that the process is frozen in __init__.py at the line:

   from .master import Master

When I import pyfmi directly from python, it doesn't freeze.

 

How to reproduce:

Install apache and libapache2-mod-wsgi (sudo apt install apache libapache2-mod-wsgi).

Add in the Apache virtual host configuration (/etc/apache2/site-enabled/000-default.conf):

        WSGIDaemonProcess testpyfmi python-path=/path/to/testpyfmi
        WSGIScriptAlias /testpyfmi /path/to/testpyfmi/wsgi.py process-group=testpyfmi
        <Directory /path/to/testpyfmi/>
        <Files wsgi.py>
        Require all granted
        </Files>
        </Directory>

and the content of wsgi.py:

import os
os.environ['USER']='www-data'
import pyfmi
def application(env,start_response):
    start_response('200 OK', [('Content-type', 'text/plain')])
    return ["pyfmi import ok\n"]

then restart apache (sudo service apache2 restart)

and download the testpage : wget localhost/testpyfmi

It prints:

--2018-03-31 23:25:12--  http://localhost/testpyfmi
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... connected.
HTTP request sent, awaiting response...

and never ends.

Does anybody have any idea on how to solve this?

Bests

Cedric