I've got a Django Web Application running in Apache with mod_wsgi during my devoted server with Centos 5.5.

However, sometimes (six or seven occasions per day) it begins to provide 500 Error for many random pages. But when I refresh the page 2 or 3 occasions, the page turns to normalcy. But when it begins to provide 500 error, almost every other page during my site gives that error.

Once I restarted the apache, it turns to normalcy for five to six hrs however it never finishes to provide that error.

I paste the entire error log below but indeed it states that DjangoUnicodeDecodeError: 'utf8' codec can't decode byte 0xdd in position 330: invalid continuation byte.

What could cause this type of error and just how can one identify it ? I might provide any extra information as soon as possible.

PS: I've same setup on my small local PC(Apache-mod_wsgi) with Win7 and I have not got this error.

[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30] mod_wsgi (pid=30331): Exception occurred processing WSGI script '/var/www/html/MY_SITE/django.wsgi'., referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30] Traceback (most recent call last):, referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30]   File "/opt/python2.7.1/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 273, in __call__, referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30]     response = self.get_response(request), referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30]   File "/opt/python2.7.1/lib/python2.7/site-packages/django/core/handlers/base.py", line 169, in get_response, referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30]     response = self.handle_uncaught_exception(request, resolver, sys.exc_info()), referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30]   File "/opt/python2.7.1/lib/python2.7/site-packages/django/core/handlers/base.py", line 203, in handle_uncaught_exception, referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30]     return debug.technical_500_response(request, *exc_info), referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30]   File "/opt/python2.7.1/lib/python2.7/site-packages/django/views/debug.py", line 59, in technical_500_response, referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30]     html = reporter.get_traceback_html(), referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30]   File "/opt/python2.7.1/lib/python2.7/site-packages/django/views/debug.py", line 117, in get_traceback_html, referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30]     frame['vars'] = [(k, force_escape(pprint(v))) for k, v in frame['vars']], referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30]   File "/opt/python2.7.1/lib/python2.7/site-packages/django/template/defaultfilters.py", line 34, in _dec, referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30]     args[0] = force_unicode(args[0]), referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30]   File "/opt/python2.7.1/lib/python2.7/site-packages/django/utils/encoding.py", line 93, in force_unicode, referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30]     raise DjangoUnicodeDecodeError(s, *e.args), referer: http://www.MY_SITE.com/
[Wed Sep 28 12:03:53 2011] [error] [client 46.104.250.30] DjangoUnicodeDecodeError: 'utf8' codec can't decode byte 0xdd in position 330: invalid continuation byte. You passed in "<WSGIRequest\\nGET:<QueryDict: {}>,\\nPOST:<QueryDict: {}>,\\nCOOKIES:{},\\nMETA:{'CSRF_COOKIE': '041ed0a93c4b355d4861a0662d49fcb4',\\n 'DOCUMENT_ROOT': '/var/www/html/MY_SITE',\\n 'GATEWAY_INTERFACE': 'CGI/1.1',\\n 'HTTP_ACCEPT': 'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',\\n 'HTTP_ACCEPT_ENCOD\\xddNG': 'gzip, deflate',\\n 'HTTP_ACCEPT_LANGUAGE': 'en-us',\\n 'HTTP_CACHE_CONTROL': 'max-age=0',\\n 'HTTP_CONNECT\\xddON': 'keep-alive',\\n 'HTTP_COOK\\xddE': 'csrftoken=10bc570d4ef77b17ce580106dafa9fb6; sessionid=60fb98634573194f7f5e18ef6014f59b',\\n 'HTTP_HOST': 'www.MY_SITE.com',\\n 'HTTP_REFERER': 'http://www.MY_SITE.com/',\\n 'HTTP_USER_AGENT': 'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B367 Safari/531.21.10',\\n 'PATH_INFO': u'/main/faq/',\\n 'PATH_TRANSLATED': '/var/www/html/MY_SITE/django.wsgi/main/faq/',\\n 'QUERY_STRING': '',\\n 'REMOTE_ADDR': '46.104.250.30',\\n 'REMOTE_PORT': '49643',\\n 'REQUEST_METHOD': 'GET',\\n 'REQUEST_URI': '/main/faq/',\\n 'SCRIPT_FILENAME': '/var/www/html/MY_SITE/django.wsgi',\\n 'SCRIPT_NAME': u'',\\n 'SERVER_ADDR': '93.94.251.82',\\n 'SERVER_ADMIN': 'bilgi@MY_SITE.com',\\n 'SERVER_NAME': 'www.MY_SITE.com',\\n 'SERVER_PORT': '80',\\n 'SERVER_PROTOCOL': 'HTTP/1.1',\\n 'SERVER_SIGNATURE': '<address>Apache/2.2.3 (CentOS) Server at www.MY_SITE.com Port 80</address>\\\\n',\\n 'SERVER_SOFTWARE': 'Apache/2.2.3 (CentOS)',\\n 'mod_wsgi.application_group': 'MY_SITE.com|',\\n 'mod_wsgi.callable_object': 'application',\\n 'mod_wsgi.handler_script': '',\\n 'mod_wsgi.input_chunked': '0',\\n 'mod_wsgi.listener_host': '',\\n 'mod_wsgi.listener_port': '80',\\n 'mod_wsgi.process_group': '',\\n 'mod_wsgi.request_handler': 'wsgi-script',\\n 'mod_wsgi.script_reloading': '1',\\n 'mod_wsgi.version': (3, 3),\\n 'wsgi.errors': <mod_wsgi.Log object at 0x2b7d75ddbfb0>,\\n 'wsgi.file_wrapper': <built-in method file_wrapper of mod_wsgi.Adapter object at 0x2b7d75f12a80>,\\n 'wsgi.input': <mod_wsgi.Input object at 0x2b7d75fa0a30>,\\n 'wsgi.multiprocess': True,\\n 'wsgi.multithread': False,\\n 'wsgi.run_once': False,\\n 'wsgi.url_scheme': 'http',\\n 'wsgi.version': (1, 1)}>" (<type 'str'>), referer: http://www.MY_SITE.com/

The site works effortlessly in Apache and Django's built-in developer server inside my local computer(Win7,Apache,mod_wsgi)