Timeout when reading response headers from daemon process

40 views
Skip to first unread message

Mahesh Vernekar

unread,
Jun 9, 2020, 6:11:08 AM6/9/20
to modwsgi
Hi Graham,

Occasionally we are getting "Timeout when reading response headers from daemon process" in apache error log.

In apache config below is the setting.
WSGIDaemonProcess author.knowdl.com python-path=/opt/data/knauthor/knauthor:/usr/lib64/python3.4/site-packages connect-timeout=360

Do you recommend removed the connect-timeout parameter ?



Regards


Mahesh

Graham Dumpleton

unread,
Jun 9, 2020, 7:46:27 AM6/9/20
to mod...@googlegroups.com
You should not be setting connect-timeout so high. The default is 15 seconds. That timeout only covers being able to create the TCP socket connection to the listener socket of the daemon process. Nothing to do with how long requests take to be handled.

Anyway, what is the remainder of your configuration for mod_wsgi? What is WSGIApplicationGroup and WSGIScriptAlias set to?

What are all the log messages being put out by mod_wsgi at the time this occurs. Ensure you are using Apache LogLevel of info rather than err or warn. Using info will result in more about what mod_wsgi is doing being displayed.

If I had to guess, it would be that you are not setting:

    WSGIApplicationGroup %{GLOBAL}

resulting in your application running in a Python sub interpreter, but you are using a Python package which uses a C extension where the C extension doesn't work properly in a sub interpreter. This can result in a thread deadlock and the sort of problem you are seeing.

So if only have the one WSGI application, set that WSGIApplicationGroup directive.

BTW, if you do need a timeout on requests, use request-timeout with WSGIDaemonProcess.

Finally, you should not need to add /usr/lib64/python3.4/site-packages to python-path. If that is required, there is something broken about your setup, perhaps including that mod_wsgi is not compiled for that Python version.

--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/3af75635-40a0-4369-a711-48d91fac7fbfo%40googlegroups.com.

Mahesh Vernekar

unread,
Jun 9, 2020, 9:45:20 AM6/9/20
to modwsgi
Hi Graham,

Thanks for you quick response. The complete configuration is:

<VirtualHost *:443>
WSGIScriptAlias / /opt/data/knauthor/knauthor/wsgi.py
Alias /static /opt/data/knauthor/knauthor/static
<Directory /opt/data/knauthor/knauthor/static>
    Require all granted
</Directory>

<Directory //opt/data/knauthor/knauthor>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

WSGIDaemonProcess author.knowdl.com python-path=/opt/data/knauthor/knauthor:/usr/lib64/python3.4/site-packages connect-timeout=360
WSGIProcessGroup author.knowdl.com
WSGIScriptAlias / /opt/data/knauthor/knauthor/wsgi.py
SSLEngine on
SSLCertificateKeyFile /opt/data/ssl/knowdl.key
SSLCertificateFile /opt/data/ssl/star_knowdl_com.crt
SSLCertificateChainFile /opt/data/ssl/DigiCertCA.crt
</VirtualHost>



Regards

Mahesh

Graham Dumpleton

unread,
Jun 9, 2020, 4:34:58 PM6/9/20
to mod...@googlegroups.com
As already mentioned, since you don't set it, add:

    WSGIApplicationGroup %{GLOBAL}

This can avoid various issues where Python packages are not designed properly to work in sub interpreters.

You also have WSGIScriptAlias duplicated unnecessarily.

Graham

--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages