Okay, this is your more recent update.

On 06/10/2014, at 4:04 AM, Carlos Vicente <[email protected]> wrote:

> I've a C++ application for which I needed to expose using a REST Web-Service. 
> And for that purpose I am using started using DJANGO-REST. After successfully 
> implemented and tested on the "DJANGO Development Server", I want to migrate 
> it to Apache+MOD_WSGI.
> 
> Up until now, every interface that implies, on the C++ part, to launch some 
> threads, I get this message:
> 
> [Sat Oct 04 02:55:25 2014] [error] [client X.X.X.X] Truncated or oversized 
> response headers received from daemon process 'ZigHomeWS': 
> /usr/local/ZigHomeWS/zighome_rest/zighom
> e_rest/WSGI/django.wsgi

In mod_wsgi 4.3.0 the messages related to problems in reading back the response 
from a mod_wsgi daemon process were changed. This was done so as to distinguish 
a timeout in reading data from the mod_wsgi daemon and other problems.

This particular message above can occur for one of two reasons.

The first is that the WSGI application returned a header which was larger than 
the buffer being used to read each response header/value line returned from the 
mod_wsgi daemon process.

The second is if the daemon process crashed and there appeared to be truncated 
or no headers returned from the mod_wsgi daemon process.

In the event of the second, you would generally see a specific error message in 
the Apache error log like 'Segmentation fault' indicating that the daemon 
process crashed.

Have a look for such a message around the point you see the above message.

With a LogLevel of info or above (you have debug), you should also see messages 
output from mod_wsgi about the daemon process vanishing and being restarted if 
it crashed. So look for those messages as well.

See what you find and send all the error messages emitted at about the time the 
problem occurred. Depending on what you get, can then see which of the two 
scenarios occurred.

If it it the size of the headers, mod_wsgi 4.3.0 now has options for 
WSGIDaemonProcess to allow the header buffer size when reading the response 
headers to be overridden.

If the daemon process is crashing, you need to attach gdb to the daemon process 
as explained in:

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

and try and work out where it is crashing.

A random guess since you are using SWIG on something, and you are already 
setting WSGIApplicationGroup to %{GLOBAL}, is that you are wrapping a shared 
library that can't be found properly at runtime when the module is loaded and 
that is causing a crash.

Graham

> (note that any other call, that implies calling other interfaces on the C++ 
> part which does not involve thread launching, no problem occurs)
> 
> At this point, and after upgrading some libraries just to make sure I wasn't 
> working with some deprecated faulty version, I've:
> 
> SWIG 3.0.2
> MOD_WSGI 4.3.0
> DJANGO (which ends up by being used by DJANGO-REST) 1.7
> DJANGO-REST 2.3.13
> Apache 2.2.2
> 
> I've followed the instructions described here 
> https://code.google.com/p/modwsgi/wiki/ApplicationIssues, specially on the 
> section "Python Simplified GIL state API", with no luck.
> 
> Here is my configuration:
> 
> Virtual host configuration:
> <VirtualHost *:80>
>         ServerAdmin [email protected]
>         ServerName my.server.com
> 
> 
>         DocumentRoot /usr/local/DummyApp
> 
> 
>         WSGIDaemonProcess ZigHomeWS 
> python-path=/usr/local/ZigHomeWS/zighome_rest:/usr/lib/python2.7:/usr/local/lib/python2.7/site-packages/django
>         WSGIProcessGroup ZigHomeWS
>         WSGIApplicationGroup %{GLOBAL}
> 
> 
>         WSGIScriptAlias /ZigHomeWS 
> /usr/local/ZigHomeWS/zighome_rest/zighome_rest/WSGI/django.wsgi
>         WSGIPassAuthorization On
>         #WSGIPythonPath /usr/local/ZigHomeWS/zighome_rest
> 
> 
> 
> 
>         <Directory /usr/local/ZigHomeWS/zighome_rest>
>             Order allow,deny
>             Allow from all
>         </Directory>
> 
> 
>         <Directory /usr/local/DummyApp>
>             Order deny,allow
>             Allow from all
>         </Directory>
> 
> 
>         ErrorLog /var/log/apache2/error_ZigHomeWS.log
> 
> 
>         # Possible values include: debug, info, notice, warn, error, crit,
>         # alert, emerg.
>         LogLevel debug
> 
> 
> </VirtualHost>
> 
> django.wsgi file:
> """
> WSGI config for zighome_rest project.
> 
> 
> It exposes the WSGI callable as a module-level variable named ``application``.
> 
> 
> For more information on this file, see
> https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
> """
> 
> 
> import os, sys
> sys.path.append('/usr/local/ZigHomeWS')
> sys.path.append('/usr/local/ZigHomeWS/zighome_rest')
> sys.path.append('/usr/local/lib/python2.7/site-packages/django')
> os.environ.setdefault("DJANGO_SETTINGS_MODULE", "zighome_rest.settings")
> 
> 
> from django.core.wsgi import get_wsgi_application
> application = get_wsgi_application()
> 
> 
> #import django.core.handlers.wsgi
> #application = django.core.handlers.wsgi.WSGIHandler()
> 
> settings.py file:
> """
> Django settings for zighome_rest project.
> 
> 
> For more information on this file, see
> https://docs.djangoproject.com/en/1.6/topics/settings/
> 
> 
> For the full list of settings and their values, see
> https://docs.djangoproject.com/en/1.6/ref/settings/
> """
> 
> 
> # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
> import os
> BASE_DIR = os.path.dirname(os.path.dirname(__file__))
> 
> 
> 
> 
> # Quick-start development settings - unsuitable for production
> # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
> 
> 
> # SECURITY WARNING: keep the secret key used in production secret!
> SECRET_KEY = '6h34&@m=1t4!(axkhz1+%6%u8^o(7^ao500pl#*+=$sk(a846@'
> 
> 
> # SECURITY WARNING: don't run with debug turned on in production!
> DEBUG = True
> 
> 
> TEMPLATE_DEBUG = True
> 
> 
> ALLOWED_HOSTS = []
> 
> 
> 
> 
> # Application definition
> 
> 
> INSTALLED_APPS = (
>     'django.contrib.admin',
>     'django.contrib.auth',
>     'django.contrib.contenttypes',
>     'django.contrib.sessions',
>     'django.contrib.messages',
>     'django.contrib.staticfiles',
>     'rest_framework',
>     'configuration',
>     'execution',
> )
> 
> 
> MIDDLEWARE_CLASSES = (
>     'django.contrib.sessions.middleware.SessionMiddleware',
>     'django.middleware.common.CommonMiddleware',
>     'django.middleware.csrf.CsrfViewMiddleware',
>     'django.contrib.auth.middleware.AuthenticationMiddleware',
>     'django.contrib.messages.middleware.MessageMiddleware',
>     'django.middleware.clickjacking.XFrameOptionsMiddleware',
> )
> 
> 
> ROOT_URLCONF = 'zighome_rest.urls'
> 
> 
> WSGI_APPLICATION = 'zighome_rest.wsgi.application'
> 
> 
> 
> 
> # Database
> # https://docs.djangoproject.com/en/1.6/ref/settings/#databases
> 
> 
> DATABASES = {
>     'default': {
>         'ENGINE': 'django.db.backends.sqlite3',
>         'NAME': '/usr/local/ZigHomeWS/zighome_rest/zighome.db',
>         'USER': '',
>         'PASSWORD': '',
>         'HOST': '',
>         'PORT': '',
>     }
> }
> 
> 
> # Internationalization
> # https://docs.djangoproject.com/en/1.6/topics/i18n/
> 
> 
> LANGUAGE_CODE = 'en-us'
> 
> 
> TIME_ZONE = 'UTC'
> 
> 
> USE_I18N = True
> 
> 
> USE_L10N = True
> 
> 
> USE_TZ = True
> 
> 
> 
> 
> # Static files (CSS, JavaScript, Images)
> # https://docs.djangoproject.com/en/1.6/howto/static-files/
> 
> 
> STATIC_URL = '/static/'
> 
> 
> directory structure under "/usr/local":
> ZigHomeWS/
>  zighome_rest
>      config
>         NodeSensors.xml
>         NodeSensors.xsd
>         Workflow.xml
>         Workflow.xsd
>      configuration
>         admin.py
>         admin.pyc
>         configuration.vim
>         __init__.py
>         __init__.pyc
>         migrations
>            0001_initial.py
>            0001_initial.pyc
>            0002_auto_20140914_1704.py
>            0002_auto_20140914_1704.pyc
>            0003_auto_20140919_1722.py
>            0003_auto_20140919_1722.pyc
>            __init__.py
>            __init__.pyc
>         models.py
>         models.pyc
>         serializers.py
>         serializers.pyc
>         tests.py
>         urls.py
>         urls.pyc
>         views.py
>         views.pyc
>      example.log
>      execution
>         admin.py
>         admin.pyc
>         Execution.vim
>         __init__.py
>         __init__.pyc
>         models.py
>         models.pyc
>         tests.py
>         urls.py
>         urls.pyc
>         views.py
>         views.pyc
>      log
>      log.html
>      manage.py
>      teste.py
>      zighome.db
>      ZigHome.py
>      ZigHome.pyc
>      zighome_rest
>         __init__.py
>         __init__.pyc
>         settings.py
>         settings.pyc
>         urls.py
>         urls.pyc
>         WSGI
>             django.wsgi
>      _ZigHome.so
> 
> 
> Any help would be greatly appreciated.
> 
> Thank you!
> 
> -- 
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/modwsgi.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to