title: mod_wsgi (3.4-14) / Apache 2.4.12 / Red Hat (6.7) / Django 1.8.2 hanging under load
body: <p>I have a problem with mod_wsgi (3.4-14) / Apache 2.4.12 / cx_oracle 5.2 / Oracle 12 / Django 1.8.2 hanging under bigger load.
  The configuration was used for the last several month in dev  / testing. </p>
  
  <p>Now when deployed to production environment Apache hangs after couple of minutes under bigger load (it works fine with small or moderate load).</p>
  
  <p>I have a cluster of 3 Django/Apache/mod_wsgi servers and when this problems happens each server stops responding (one by one) within 5 - 15 minutes.</p>
  
  <p>Here is my configuration</p>
  
  <p>I am using Python 3.3 and Apache 2.4.12 and mod_wsgi-3.4-14 from Red Hat (6.7) Software Collection  </p>
  
  <p>Apache Virtual Host
  
  ...
          WSGIDaemonProcess app.prod processes=2 threads=25 display-name=%{GROUP} user=MY_USER python-path=MY_PATH
          WSGIProcessGroup app.prod
          WSGIScriptAlias / /opt/hosts/app/app/wsgi.py
  </p>
  
  <pre><code>Apache version
  Server version: Apache/2.4.12 (Red Hat)
  Server built:   Aug 11 2015 08:12:59
  Server's Module Magic Number: 20120211:41
  Server loaded:  APR 1.5.1, APR-UTIL 1.5.4
  Compiled using: APR 1.5.1, APR-UTIL 1.5.4
  Architecture:   64-bit
  Server MPM:     worker
    threaded:     yes (fixed thread count)
      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="/opt/rh/httpd24/root/etc/httpd"
   -D SUEXEC_BIN="/opt/rh/httpd24/root/usr/sbin/suexec"
   -D DEFAULT_PIDLOG="/opt/rh/httpd24/root/var/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"
  </code></pre>
  
  <p>python33-mod_wsgi-3.4-14.el6.x86_64</p>
  
  <pre><code>Django db configuration
  'default': {
      'ENGINE': 'django.db.backends.oracle',
      'NAME': 'DB_NAME',
      'USER': 'webuser',
      'PASSWORD': 'webpassword',
      'HOST': '',
      'PORT': '',
      'CONN_MAX_AGE': None,
      'OPTIONS': {
          'threaded': True,
      },
  },
  
  
  #0  0x00007f047ff099b0 in sem_wait () from /lib64/libpthread.so.0
  #1  0x00007f0474b4c6d8 in PyThread_acquire_lock_timed () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #2  0x00007f0474b2cab5 in _PyImport_AcquireLock () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #3  0x00007f0474b2cf49 in PyImport_ImportModuleLevelObject () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #4  0x00007f0474b10f8f in ?? () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #5  0x00007f0474b1baa4 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #6  0x00007f0474b1b0f9 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #7  0x00007f0474b1c457 in PyEval_EvalCodeEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #8  0x00007f0474b1aead in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #9  0x00007f0474b1b0f9 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #10 0x00007f0474b1b0f9 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #11 0x00007f0474b1b0f9 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #12 0x00007f0474b1b0f9 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #13 0x00007f0474b1b0f9 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #14 0x00007f0474b1b0f9 in PyEval_EvalFrameEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #15 0x00007f0474b1c457 in PyEval_EvalCodeEx () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #16 0x00007f0474a90842 in ?? () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #17 0x00007f0474a69fd6 in PyObject_Call () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #18 0x00007f0474b11763 in PyEval_CallObjectWithKeywords () from /opt/rh/python33/root/usr/lib64/libpython3.3m.so.1.0
  #19 0x00007f0474e8f6ac in ?? () from /opt/rh/httpd24/root/etc/httpd/modules/mod_python33-wsgi.so
  #20 0x00007f0474e93f8b in ?? () from /opt/rh/httpd24/root/etc/httpd/modules/mod_python33-wsgi.so
  #21 0x00007f0474e976c8 in ?? () from /opt/rh/httpd24/root/etc/httpd/modules/mod_python33-wsgi.so
  #22 0x00007f047ff03a51 in start_thread () from /lib64/libpthread.so.0
  #23 0x00007f047fc509ad in clone () from /lib64/libc.so.6
  </code></pre>
  
  <p>If I reduce the number of mod_wsgi then the problem goes away but the performance is not acceptable</p>
  
  <pre><code>WSGIDaemonProcess app.prod processes=4 threads=1 display-name=%{GROUP} user=MY_USER python-path=MY_PATH
  </code></pre>
  
  <p>Could anybody suggest what could be the cause or how could I debug it please?</p>
  
  <p><a href="https://groups.google.com/forum/#!topic/modwsgi/99oBs1FucSw" rel="nofollow">More details on mod_wsgi mailing list</a></p>