87671

Mod_wsgi worker processes segmentation fault (11)

I am having a problem with my django application, which is hosted with apache/mod_wsgi. I added some matplotlib code into the application, and apache worker processes now crashing.

I reduced this problem to the following:

    <li>Without any matplotlib imports application works ok</li> <li>when "import matplotlib" is added anywhere in the application, worker processes die with segfault and users see no reply from server</li> <li>"import matplotlib" works just fine in commandline python interpreter - segfault happens only in apache processes</li> </ul>

    Here is the log entry:

    [Tue May 24 08:29:08 2011] [notice] child pid 17576 exit signal Segmentation fault (11)

    I cannot reproduce problem on other computer. I tried to remove (rm site-packages/matplotli*) and install different versions of matplotlib (0.99.3, 1.0.0, 1.0.1) I tried to install all modules in virtualenv and point to virtualenv from my .wsgi script.

    I tried this: Error: child pid 6695 exit signal Segmentation fault (11) I read http://code.google.com/p/modwsgi/wiki/ as well.

    Any pointers on how to debug/workaround this issue will be much appreciated.

    (I am even ready to move to any other server (paste/cherrypy + apache mod_proxy, etc.) to eliminate the problem.)

    Here are my apache settings:

    <strong>/usr/sbin/httpd -V</strong>

    Server version: Apache/2.2.15 (Unix) Server built: Apr 10 2010 11:21:07 Server's Module Magic Number: 20051115:24 Server loaded: APR 1.3.9, APR-Util 1.3.10 Compiled using: APR 1.3.9, APR-Util 1.3.9 Architecture: 32-bit Server MPM: Prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APACHE_MPM_DIR="server/mpm/prefork" -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=128 -D HTTPD_ROOT="/etc/httpd" -D SUEXEC_BIN="/usr/sbin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf"

    <strong>/usr/sbin/httpd -l</strong>

    Compiled in modules: core.c prefork.c http_core.c mod_so.c

    <strong>/usr/sbin/httpd -M</strong>

    Loaded Modules: core_module (static) mpm_prefork_module (static) http_module (static) so_module (static) auth_basic_module (shared) auth_digest_module (shared) authn_file_module (shared) authn_alias_module (shared) authn_anon_module (shared) authn_dbm_module (shared) authn_default_module (shared) authz_host_module (shared) authz_user_module (shared) authz_owner_module (shared) authz_groupfile_module (shared) authz_dbm_module (shared) authz_default_module (shared) ldap_module (shared) authnz_ldap_module (shared) include_module (shared) log_config_module (shared) logio_module (shared) env_module (shared) ext_filter_module (shared) mime_magic_module (shared) expires_module (shared) deflate_module (shared) headers_module (shared) usertrack_module (shared) setenvif_module (shared) mime_module (shared) dav_module (shared) status_module (shared) autoindex_module (shared) info_module (shared) dav_fs_module (shared) vhost_alias_module (shared) negotiation_module (shared) dir_module (shared) actions_module (shared) speling_module (shared) userdir_module (shared) alias_module (shared) rewrite_module (shared) wsgi_module (shared) ssl_module (shared) Syntax OK

    <strong>Apache config</strong>

    <VirtualHost *:443> ServerName somesite.com DocumentRoot "/somedir" WSGIApplicationGroup %{GLOBAL} WSGIScriptAlias / /somedir/production.wsgi <..> </VirtualHost>

    Answer1:

    In the wiki you said you read, you should have found:

    http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Debugging_Crashes_With_GDB

    As a side note, it is recommended you do not use prefork/embedded mode. User mod_wsgi daemon mode if you are forced to use prefork MPM. Read:

    http://blog.dscpl.com.au/2009/03/load-spikes-and-excessive-memory-usage.html

    for some of the reasons why.

    Other people have got matplotlib working with mod_wsgi, so not obvious straight away what the issue is.

Recommend

  • Check if a program exists in bash
  • How to exit “docker run” containers once the script those containers execute calls exit()
  • (Un)setting a cookie in mod_rewrite
  • deploying Node.js app for production
  • https in htaccess and order of rules (using Expression Engine)
  • Passing a Scala type to a function
  • Pass nested C++ vector as built-in style multi-dimensional array
  • Ruby: FileUtils.cp truncates file; FileUtils.mv it does not?
  • NHibernate proxyexception
  • Python adding lots of things to PATH. How do I stop?
  • File extension of zlib zipped html page?
  • iOS Cordova first plugin - plugin.xml to inject a feature
  • Error in installing package: fatal error: stdlib.h: no such file or directory
  • In-place sed command not working
  • OSX - always hide certain files
  • bad substitution shell- trying to use variable as name of array
  • Java color detection
  • IE7 and TinyMCE with Plone
  • cygwin cannot exec 'git-add--interactive' permission denied
  • Moving Android View and preventing onDraw to be called over and over again
  • Is playing sound in Javascript performance heavy?
  • error importing numpy
  • Is there a perl module to validate passwords stored in “{crypt}hashedpassword” “{ssha}hashedpassword
  • Installing iPhone App to iPhone
  • Problem deserializing objects from cache on MyBatis 3/Java
  • HTTP/2 streams vs HTTP/1.1 connections
  • Could not find rake using whenever rails
  • Meteor helpers not available in Angular template
  • C++ Partial template specialization - design simplification
  • Cannot resolve symbol 'MyApi'
  • Is there a javascript serializer for JSON.Net?
  • Cannot connect to cassandra from Spark
  • Deserializing XML into class C#
  • Where to put my custom functions in Wordpress?
  • How to include full .NET prerequisite for Wix Burn installer
  • Buffer size for converting unsigned long to string
  • using HTMLImports.whenReady not working in chrome
  • costura.fody for a dll that references another dll
  • Binding checkboxes to object values in AngularJs
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize