I'm running Apache, installed using macports on OS X, to serve a Django app.
I'm getting many lines in the Apache error_log like these:
[Wed Feb 23 11:35:42 2011] [error] Exception KeyError: KeyError(-1606572256,) in <module 'threading' from '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/threading.pyc'> ignored
The server doesn't seem to be having noticeable problems while these errors are logged, but it does crash every so often requiring a manual restart - which may or may not be related to these error messages.
Any ideas?
That bug is almost a year old. Update mod_wsgi.
Related
I have some performance issues with my Flask application on openshift.
There is a need to get some images from database and display them on the web page. And
for this taks, I have created a simple method :
#app.route('/getImage/')
def getImageFromUrl(url=None):
return make_response(getImageFromDb(request.args['url']));
There are maximum 10 images per page. And the problem is that this is slow.... veerry slow.
On my local machine, started with app.run() (even in debug mode) it is super fast, so I asume there is something in mod_wsgi.
Also there are these error messages in log files:
Exception KeyError: KeyError(140116433057760,) in <module 'threading' from '/usr/lib64/python2.6/threading.pyc'> ignored
and
[error] server reached MaxClients setting, consider raising the MaxClients setting
What is happening and what should I do to speed the things up?
Exception KeyError is caused by gevent I guess, should be more code in question :) To avoid it import gevent before all.
server reached MaxClients setting seems to be Apache error and should be investigated with logs and settings MaxClients and ServerLimt.
The KeyError is usually because you are using an old version of mod_wsgi. Use mod_wsgi 3.3 or later, which has changes to accommodate the changes which were made in Python that caused this.
I keep getting these errors in my Apache logs:
[error] python_init: Python version mismatch, expected '2.6.5+', found '2.6.6'.
[error] python_init: Python executable found '/usr/bin/python'.
[error] python_init: Python path being used '/usr/lib/python2.6/:/usr/lib/python2.6/plat-linux2:/usr/lib/python2.6/lib-tk:/usr/lib/python2.6/lib-old:/usr/lib/python2.6/lib-dynload'.
[notice] mod_python: Creating 8 session mutexes based on 150 max processes and 0 max threads.
[notice] mod_python: using mutex_directory /tmp
From what I've read, these errors come from mod_python. I'm using Flask and WSGI for my Python project, however, so I don't know why these errors are coming up.
Is there an easy way I can delete mod_python? - I've tried a2dismod, but mod_python doesn't appear to exist, even though I see it within Apache's mods-available directory.
EDIT: I've just tried a2dismod python, and that seems to have worked. I think I n00bishly was trying to disable mod_python. My Python apps still appear to work just fine.
Thanks in advance!
Look through your httpd.conf file, and remove the line that says:
LoadModule mod_python /path/to/mod_python.so
Then restart apache:
apachectl restart
I have installed askbot.org on my local machine and When I tri to use google openid, I get following error. Here is full apache log. (I have replaced some hex strings)
http://bit.ly/apache_log
Can someone explain to me what could be problem ?
From your log, this seems to be the big issue:
[Wed Mar 07 22:58:13 2012] [error] Received "invalidate_handle" from server
From the answer to this question on invalidate_handle, it looks like a bug in the "Relying Party". I would double-check your configuration.
I'm using mod_wsgi for a Django application (OSQA) on RHEL 5 with Python 2.43 (cannot upgrade).
I had the site set up and working fine, and then tried to integrate the authentication with python-ldap for accessing Active Directory attributes e.g. a user's name, email address etc.
Apache httpd crashes with the following message:
[notice] child pid 18705 exit signal Segmentation fault (11)
I originally thought this was due to inconsisten expat libraries between Apache and Python, but I have since upgraded the libexpat.so module to match the Python version of pyexpat (1.95.8).
From heavy logging in the django log, I can see the seg fault occurs when this line is executed:
con = ldap.initialize(AD_LDAP_URL)
Is there something specific with python-ldap causing this issue? Any other thoughts on how to debug?
Thanks
Try disabling any Apache modules for auth which use LDAP. Also try disabling mod_php if being used and it is loading a LDAP extension. In short, library version conflict may be because of LDAP libraries rather than expat, so disable the other Apache modules and see if problem goes away. That will narrow it down.
I installed stackless pyton 2.6.2 after reading several sites that said its fully compatible with vanilla python. After installing i found that my django applications do not work any more.
I did reinstall django (1.1) again and now im kind of lost. The error that i get is 500:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster#localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2.11 (Ubuntu) DAV/2 PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch mod_python/3.3.1 Python/2.6.2 mod_ruby/1.2.6 Ruby/1.8.7(2008-08-11) mod_ssl/2.2.11 OpenSSL/0.9.8g Server at 127.0.0.1 Port 80
What else, could or should i do?
Edit: From 1st comment i understand that the problem is not in django but mod_python & apache? so i edited my question title.
Edit2: I think something is wrong with some paths setup. I tried going from mod_python to mod_wsgi, managed to finally set it up correctly only to get next error:
[Sun Aug 16 12:38:22 2009] [error] [client 127.0.0.1] raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
[Sun Aug 16 12:38:22 2009] [error] [client 127.0.0.1] ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
Alan
When you install a new version of Python (whether stackless or not) you also need to reinstall all of the third party modules you need -- either from sources, which you say you don't want to do, or from packages built for the new version of Python you've just installed.
So, check the repository from which you installed Python 2.6.2 with aptitude: does it also have versions for that specific Python of mod_python, mysqldb, django, and any other third party stuff you may need? There really is no "silver bullet" for package management and I know of no "sumo distribution" of Python bundling all the packages you could ever possibly need (if there were, it would have to be many 10s of GB;-).