With apache2.4.6 and mod_wsgi4.7.1 process requests of 30 seconds or more fail to render any results.

23 views
Skip to first unread message

Alan Batakis

unread,
Apr 28, 2020, 4:51:01 PM4/28/20
to modwsgi

I getting a rendering hang if a process request takes more that 30 seconds to complete. I am not sure whether the hang is caused by Apache or mod_wsgi. I get no errors and nothing in any log file to indicate there is a problem.


I am moving an application from apache2.2/mod_python to apache2.4.6/mod_wsgi and everything runs just fine, except that my application occasionally takes more than 30 seconds to assemble all the data needed to process a request. When this happens the page never renders and I cannot find anything to debug... To simplify things for testing I've used a bare bones "hello world" python program (below) with a time.sleep(30) in it and that also fails to render the page, again a time delay of 29 seconds or less and everything works fine. The results are consistent on Chrome/FF/IE browsers.


I am using:
    mod_wsgi 4.7.1
    python 2.7.5, and Django
    Oracle HTTP Server 12.2.1.3 which runs Apache 2.4.6  (see long listing below)
    Red Hat Enterprise Linux Server release 7.4 (Maipo)


Googling around I've found lots advice and I've tweaked both Apache and mod_wsgi settings but nothing seems to make a difference. The most promising setting I came across was "queue-timeout" but setting that didn't seem to make a difference:

--queue-timeout SECONDS
                        Maximum number of seconds allowed for a request to be
                        accepted by a worker process to be handled, taken from
                        the time when the Apache child process originally
                        accepted the request. Defaults to 30 seconds.


I am at a lost for how to fix this issue or even how to better debug it, any advice or suggestions would be very welcome.


---------------------------- more detail -----------------------------

I  get the same results whether I am in embedded or Daemon mod_wsgi mode.

-----------------------------my httpd.conf "tweaks" -------------

<Directory /scratch/ohs>
    Require all granted
</Directory>
LoadModule wsgi_module "${PRODUCT_HOME}/modules/mod_wsgi.so"
WSGIDaemonProcess localhost:7780 processes=2 threads=15 request-timeout=0 socket-timeout=1000 queue-timeout=60
WSGIApplicationGroup %{GLOBAL}
WSGIProcessGroup localhost:7780
WSGIScriptAlias /test /scratch/ohs/test_app/test_thirty

--------------------------- my trivial application ---------------------------

import time
def application(environ, start_response):
    status = '200 OK'
    output = 'Testing with a 30 second sleep.'
    time.sleep(30)

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

----------------------  some of my environment setup results from https://code.google.com/archive/p/modwsgi/wikis/CheckingYourInstallation.wiki#Sub_Interpreter_Being_Used

$ /usr/sbin/httpd -V
Server version: Apache/2.4.6 ()
Server built:   Aug  7 2019 04:35:38
Server's Module Magic Number: 20120211:24
Server loaded:  APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="/run/httpd/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

$ /usr/sbin/httpd -l
Compiled in modules:
  core.c
  mod_so.c
  http_core.c

$ /usr/sbin/httpd -M
Loaded Modules:
 core_module (static)
 so_module (static)
 http_module (static)
 access_compat_module (shared)
 actions_module (shared)
 alias_module (shared)
 allowmethods_module (shared)
 auth_basic_module (shared)
 auth_digest_module (shared)
 authn_anon_module (shared)
 authn_core_module (shared)
 authn_dbd_module (shared)
 authn_dbm_module (shared)
 authn_file_module (shared)
 authn_socache_module (shared)
 authz_core_module (shared)
 authz_dbd_module (shared)
 authz_dbm_module (shared)
 authz_groupfile_module (shared)
 authz_host_module (shared)
 authz_owner_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 cache_module (shared)
 cache_disk_module (shared)
 data_module (shared)
 dbd_module (shared)
 deflate_module (shared)
 dir_module (shared)
 dumpio_module (shared)
 echo_module (shared)
 env_module (shared)
 expires_module (shared)
 ext_filter_module (shared)
 filter_module (shared)
 headers_module (shared)
 include_module (shared)
 info_module (shared)
 log_config_module (shared)
 logio_module (shared)
 mime_magic_module (shared)
 mime_module (shared)
 negotiation_module (shared)
 remoteip_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 slotmem_plain_module (shared)
 slotmem_shm_module (shared)
 socache_dbm_module (shared)
 socache_memcache_module (shared)
 socache_shmcb_module (shared)
 status_module (shared)
 substitute_module (shared)
 suexec_module (shared)
 unique_id_module (shared)
 unixd_module (shared)
 userdir_module (shared)
 version_module (shared)
 vhost_alias_module (shared)
 dav_module (shared)
 dav_fs_module (shared)
 dav_lock_module (shared)
 lua_module (shared)
 mpm_prefork_module (shared)
 proxy_module (shared)
 lbmethod_bybusyness_module (shared)
 lbmethod_byrequests_module (shared)
 lbmethod_bytraffic_module (shared)
 lbmethod_heartbeat_module (shared)
 proxy_ajp_module (shared)
 proxy_balancer_module (shared)
 proxy_connect_module (shared)
 proxy_express_module (shared)
 proxy_fcgi_module (shared)
 proxy_fdpass_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_scgi_module (shared)
 proxy_wstunnel_module (shared)
 systemd_module (shared)
 cgi_module (shared)
 wsgi_module (shared)

$ ldd /scratch/ohs/middleware/ohs/modules/mod_wsgi.so
        linux-vdso.so.1 =>  (0x00007ffd21c67000)
        libpython2.7.so.1.0 => /usr/lib64/libpython2.7.so.1.0 (0x00007fa03afac000)
        libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007fa03ad8f000)
        libc.so.6 => /usr/lib64/libc.so.6 (0x00007fa03a9c1000)
        libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007fa03a7bd000)
        libutil.so.1 => /usr/lib64/libutil.so.1 (0x00007fa03a5b9000)
        libm.so.6 => /usr/lib64/libm.so.6 (0x00007fa03a2b7000)
        /lib64/ld-linux-x86-64.so.2 (0x000055f61a899000)

Graham Dumpleton

unread,
Apr 28, 2020, 4:54:11 PM4/28/20
to mod...@googlegroups.com
Are you accessing the application through a firewall or proxy router?

Ensure you are setting:

  LogLevel info

and not just 'warn' or 'err' for log level. This will result in more logging being output to show what is going on.

--
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/87a7bfa7-eb07-4aad-b041-27fb67995e33%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages