Apache 2 process stopped - django

Today I made some changes, but only on fron-end side of my page and pushes those changes on the server. I checked if everything works under my domain and it was fine. But after about two hours I am getting only 500 Internal Server Error. I have such logs:
[Sun Jul 10 00:19:12 2016] [notice] Digest: generating secret for digest authentication ...
[Sun Jul 10 00:19:12 2016] [notice] Digest: done
[Sun Jul 10 00:19:12 2016] [info] mod_fcgid: Process manager 3584465 started
[Sun Jul 10 00:19:12 2016] [notice] Apache/2.2.22 (Debian) mod_fcgid/2.3.6 configured -- resuming normal operations
[Sun Jul 10 00:19:12 2016] [info] Server built: Mar 31 2015 17:28:57
[Sun Jul 10 00:19:12 2016] [info] mod_fcgid: server myuser:/home/.../django.fcgi(3584772) started
[Sun Jul 10 00:24:20 2016] [info] removed PID file /home/xxx/admin/apache/run/apache.pid (pid=3584452)
[Sun Jul 10 00:24:20 2016] [notice] caught SIGWINCH, shutting down gracefully
[Sun Jul 10 00:24:21 2016] [info] mod_fcgid: process /home/.../django.fcgi(3584772) exit(shutting down), terminated by calling exit(), return code: 0
[Sun Jul 10 00:24:21 2016] [info] mod_fcgid: Process manager 3584465 stopped
Can anyone provide a solution or some suggestions of how to overcome this problem?

The problem is you're getting SIGWINCH which means window size has changed. Doesn't make much sense for a server though.
Okay, just found out SIGWINCH is misused by Apache to perform a graceful shutdown. Your question is a dup of this one

Related

My Wamp is bugging down?

I installed mysql and wamp 2.4 in my server . I made my wamp automatically start upon startup and also disabled wampmysqld so that it will not conflict with mysql.
Then i put my wamp online .
Last month I can smoothly access my server in my LAN network.
But sometimes this week, I cannot access my server's localhost page on my LAN network. I have to open wamp again and and restart all services and its annoying . There are days that wamp will work the whole day and sometimes you need to restart all services again what seems to be the problem and how to solve this?
I open apache logfile and find this error
[Fri Mar 11 13:45:36.654882 2016] [core:notice] [pid 3200:tid 492] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.4\\bin\\httpd.exe -d C:/wamp/bin/apache/Apache2.4.4'
[Fri Mar 11 13:45:36.655882 2016] [mpm_winnt:notice] [pid 3200:tid 492] AH00418: Parent: Created child process 3568
[Fri Mar 11 13:45:37.149910 2016] [mpm_winnt:notice] [pid 3568:tid 300] AH00354: Child: Starting 150 worker threads.

Running WSF-CPP samples

I'm trying to run the Echo sample that comes with WSO2 WSF-CPP, and I get the following errors:
[Tue Dec 18 14:26:51 2012] [error] dep_engine.c(1008) Axis2
Configuration file name not found [Tue Dec 18 14:26:51 2012] [error]
dep_engine.c(872) axis2.xml is not available in client repo . [Tue
Dec 18 14:26:51 2012] [error] conf_init.c(201) Loading deployment
engine failed for client repository . [Tue Dec 18 14:26:51 2012]
[critical] ServiceClient.cpp(223) Cannot create service client
I follow the installation steps in 1 and I don't have any problem, but I'm thinking that there is something missed.
Thanks in advance,
U.
1[http://wso2.org/library/tutorials/dummys-guide-writing-web-service-clients-wso2-wsf-c#Running_Your_First_Web_Service_Client_with_WSO2_WSF_CPP]
Set the environemnt variable WSFCPP_HOME to your WSO2 CPP installation path.
Seems your path is not set correctly thats why you are seeing this error.
(I can run the samples in linux)

Installing Django with mod_wsgi in centos, ImportError: No module named os

I have, this httpd.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.hello2.ch
DocumentRoot /home/django_www/hello
WSGIScriptAlias / /var/www/django_www/hardi/django.wsgi
ErrorLog /var/www/django_www/hardi/error_log
CustomLog /var/www/django_www/hardi/access_log common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/html
</VirtualHost>
vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
128.178.131.89 www.hello2.ch
128.178.131.89 ohtersite.ch
python 2.5, mod_wsgi-2.5, /root/epd-5.1.0/lib/libpython2.5.so.1.0 : installed!
ldd /root/epd-5.1.0/bin/python
libpython2.5.so.1.0 => /root/epd-5.1.0/lib/libpython2.5.so.1.0 (0x00002b1bb7333000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003da0600000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003d9fe00000)
libutil.so.1 => /lib64/libutil.so.1 (0x0000003dadc00000)
libm.so.6 => /lib64/libm.so.6 (0x0000003da0200000)
libc.so.6 => /lib64/libc.so.6 (0x0000003d9fa00000)
/lib64/ld-linux-x86-64.so.2 (0x0000003d9f600000)
echo $LD_LIBRARY_PATH
/root/epd-5.1.0/lib/
But when i try to load the webpage, i get the following error_log:
'import site' failed; use -v for traceback
[Wed Aug 29 11:52:57 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Aug 29 11:52:57 2012] [notice] Digest: generating secret for digest authentication ...
[Wed Aug 29 11:52:57 2012] [notice] Digest: done
[Wed Aug 29 11:52:57 2012] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Wed Aug 29 11:52:57 2012] [notice] Apache/2.2.3 (Red Hat) configured -- resuming normal operations
[Wed Aug 29 11:55:00 2012] [error] [client 66.249.72.187] Symbolic link not allowed or link target not accessible: /var/www/html/app/webroot/w3
[Wed Aug 29 11:58:30 2012] [error] [client 66.249.72.187] Symbolic link not allowed or link target not accessible: /var/www/html/app/webroot/w3
[Wed Aug 29 12:01:58 2012] [error] [client 66.249.72.187] Symbolic link not allowed or link target not accessible: /var/www/html/app/webroot/w3
[Wed Aug 29 12:05:30 2012] [error] [client 66.249.72.187] Symbolic link not allowed or link target not accessible: /var/www/html/app/webroot/w3
[Wed Aug 29 12:09:00 2012] [error] [client 66.249.72.187] Symbolic link not allowed or link target not accessible: /var/www/html/app/webroot/w3
[Wed Aug 29 12:12:29 2012] [error] [client 66.249.72.187] Symbolic link not allowed or link target not accessible: /var/www/html/app/webroot/w3
[Wed Aug 29 12:14:06 2012] [error] [client 178.33.137.225] Symbolic link not allowed or link target not accessible: /var/www/html/app/webroot/w3
[Wed Aug 29 12:15:59 2012] [error] [client 66.249.72.187] Symbolic link not allowed or link target not accessible: /var/www/html/app/webroot/w3
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
'import site' failed; use -v for traceback
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
....
'import site' failed; use -v for traceback
[Wed Aug 29 12:17:47 2012] [notice] caught SIGTERM, shutting down
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
'import site' failed; use -v for traceback
[Wed Aug 29 12:17:47 2012] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Aug 29 12:17:47 2012] [notice] Digest: generating secret for digest authentication ...
[Wed Aug 29 12:17:47 2012] [notice] Digest: done
[Wed Aug 29 12:17:47 2012] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
[Wed Aug 29 12:17:47 2012] [notice] Apache/2.2.3 (Red Hat) configured -- resuming normal operations
[Wed Aug 29 12:18:01 2012] [error] Traceback (most recent call last):
[Wed Aug 29 12:18:01 2012] [error] File "/var/www/django_www/hardi/django.wsgi", line 1, in <module>
[Wed Aug 29 12:18:01 2012] [error] import os
[Wed Aug 29 12:18:01 2012] [error] ImportError: No module named os
Any idea, in how to make Django work with mod_wsgi, and how can i make it possible to match the first VirtualHost entry with www.hello2.ch webpage and all the others at the second VirtualHost entry?
Run 'ldd' on the mod_wsgi.so.
The problem is likely that it is finding a different Python version. It can also be that since your Python is not in a standard location, that it doesn't know where to find the installation.
In the latter case, add at global scope, outside of VirtualHost, in your Apache configuration:
WSGIPythonHome /root/epd-5.1.0
The value should correspond to the value of sys.prefix printed from your Python when run.
import sys
print sys.prefix
Based on the errors you've got, it seems like a couple of things could be going on. Rather than throwing all this into comments, however, I'll go ahead and post as an answer.
In my django.wsgi file I have the following two lines that change the PATH environment variable to let python import packages from my django project:
import sys
sys.path.append('/path/to/mysite.com/app/mydjangoproject')
You'll also want to make sure you add the following in your httpd.conf inside the VirtualHost that will you will be using django with:
<Directory /path/to/mysite.com/app/mydjangoproject>
Order allow,deny
Allow from all
</Directory>
EDIT:
With regard to the symbolic link that you mention in your comments that appears in the error messages, I'm not quite sure what to make of it. If you are just trying to use it to allow apache to access resources that are outside of the DocumentRoot, you'll want to add the Options FollowSymLinks directive for Directory that contains the symbolic link

Apache installation for django project

Iam trying to install and configure apache for python 2.7 to develop a django application.
wsgi module is configured.
and I had did the following settings
edit httpd config file
Alias /media/ 'D:/myProjects/mysite/site_media/'
Order deny,allow
Allow from all
WSGIScriptAlias / 'D:\myProjects\mysite\apache\django.wsgi'
Order deny,allow
Allow from all
Create a folder apache in my site,say D:\myProjects\mysite\apache
Create wsgi script named 'django.wsgi'
import os
import sys
sys.path.append('D:\myProjects')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Create a new folder in my site folder named 'site_media'
Copy all images,css,javascript here
Edit template with path to css & images like this
href="/media/style.css"
But when Enter 'http://127.0.0.1' in browser the browser is loading.....but not connecting to my site
when checked in error log
the error is
[Tue May 08 16:59:41 2012] [notice] Parent: child process exited with status 1 -- Restarting.
[Tue May 08 16:59:41 2012] [warn] mod_wsgi: Compiled for Python/2.7.
[Tue May 08 16:59:41 2012] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Tue May 08 16:59:41 2012] [notice] Apache/2.2.21 (Win32) mod_wsgi/3.3 Python/2.7.3
configured -- resuming normal operations
[Tue May 08 16:59:41 2012] [notice] Server built: Sep 9 2011 10:26:10
[Tue May 08 16:59:41 2012] [notice] Parent: Created child process 2408
[Tue May 08 16:59:41 2012] [warn] mod_wsgi: Compiled for Python/2.7.
[Tue May 08 16:59:41 2012] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Tue May 08 16:59:41 2012] [notice] Child 2408: Child process is running
ImportError: No module named site
Please help me ..
if you are using apache2, you have to configure /etc/apache2/sites-enabled/000-default because it doesnt use httpd.config you have mentioned...

Where are my 500s coming from in my DJango app?

I've got Apache setup on windows, (yes, not a very good idea, but not my fault). I open a popup window with about 32 images in it and all but 3 of those image links work. The images are coming from a TIF file and therefore have to be converted, so it is running thru my Django app to do all this and that part is working. The 3 urls that fail, when retried work.
In the apache log, I get 29 200s followed by 3 500s, but the actual images that failed to load are scattered randomly among the 29 good images. When I watch the log with tail -f, the 500s come along many seconds after the 200s but timestamped BEFORE them, like so:
192.168.20.45 - - [08/Mar/2012:01:24:28 -0600] "GET /viewer/... 200 44277
192.168.20.45 - - [08/Mar/2012:01:24:28 -0600] "GET /viewer/... 200 52283
192.168.20.45 - - [08/Mar/2012:01:24:28 -0600] "GET /viewer/... 200 44991
192.168.20.45 - - [08/Mar/2012:01:24:29 -0600] "GET /viewer/... 200 33077
192.168.20.45 - - [08/Mar/2012:01:24:22 -0600] "GET /viewer/... 500 16
192.168.20.45 - - [08/Mar/2012:01:24:22 -0600] "GET /viewer/... 500 16
192.168.20.45 - - [08/Mar/2012:01:24:22 -0600] "GET /viewer/... 500 16
DEBUG=False, and admins are setup, so I should get an email for every 500 that happens in Django, I've tested the email and it works as expected. The code I'm going thru has logging statements for error conditions and none of those are triggering.
It's almost like Apache or Mod_wsgi knows these connections come in, but never passes them to the Django code and they just end up dying from what seems to be a timeout. Chrome DevTools ends up showing me:
**Response Headers**
Connection:close
Content-Type:text/html; charset=utf-8
Date:Thu, 08 Mar 2012 07:24:22 GMT
Server:Apache/2.2.21 (Win32) mod_wsgi/3.3 Python/2.7.2
Set-Cookie:sessionid=d4616w0f850u1eb33q7a6fzf37f840b5; Path=/
Transfer-Encoding:chunked
Vary:Cookie
I'm on windows, and Apache says this on startup:
[Thu Mar 08 01:38:09 2012] [warn] mod_wsgi: Compiled for Python/2.7.
[Thu Mar 08 01:38:09 2012] [warn] mod_wsgi: Runtime using Python/2.7.2.
[Thu Mar 08 01:38:09 2012] [notice] Apache/2.2.21 (Win32) mod_wsgi/3.3 Python/2.7.2 configured -- resuming normal operations
[Thu Mar 08 01:38:09 2012] [notice] Server built: Sep 9 2011 10:26:10
[Thu Mar 08 01:38:09 2012] [notice] Parent: Created child process 3260
[Thu Mar 08 01:38:09 2012] [warn] mod_wsgi: Compiled for Python/2.7.
[Thu Mar 08 01:38:09 2012] [warn] mod_wsgi: Runtime using Python/2.7.2.
[Thu Mar 08 01:38:09 2012] [notice] Child 3260: Child process is running
[Thu Mar 08 01:38:09 2012] [notice] Child 3260: Acquired the start mutex.
[Thu Mar 08 01:38:09 2012] [notice] Child 3260: Starting 64 worker threads.
[Thu Mar 08 01:38:09 2012] [notice] Child 3260: Starting thread to listen on port 80.
There are less than 64 requests so there should be threads left over to handle them.
Any ideas on WHAT is happening? or HOW to figure it out?
EDIT----
There is no traceback, that is the problem. There is no indication at all that Python ever saw this request.
Yes, you shouldn't use python to serve static files, but you can't put a single image TIFF from a multi image TIFF into an you have to pull it from the multi-image file, put it in a format the browser can display, and no you don't want to convert the 100+ million TIFF images into single image PNGs or JPEG. AND these are not images that can be viewed by the general public, but are restricted to their "owners"
Loaded this on a second machine and the problem does not happen.....
You can write a small middleware to handle the exception. You can do some logging in the process_exception method, to find the root of the problem:
https://docs.djangoproject.com/en/dev/topics/http/middleware/#process-exception