Opened 7 years ago

Closed 5 years ago

#11334 closed Bug (duplicate)

Django fails to show non-latin exception messages from PostgreSQL running on FastCGI

Reported by: Loststylus Owned by: nobody
Component: Core (Other) Version: 1.1-beta
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Run django via FastCGI (used nginx 0.6.x to deploy) with PosgreSQL. Try to execute some query, that will produce an error. If the error returned by PosgreSQL is not latin (Russian in my case), django tries to render an error page, but fails. nginx return a page with "Unhandled exception"

If you turn on debug in flup, you will see the traceback, that shows that django tries to force_unicode the error message and fails with UnicodeDecodeError, so the user cannot determine the problem.

I'll attach a flup error page with stack trace.

Attachments (1)

flup_stack_trace.html (23.8 KB) - added by Loststylus 7 years ago.
Flup stack trace for the django's debug system unicode decode error

Download all attachments as: .zip

Change History (10)

Changed 7 years ago by Loststylus

Attachment: flup_stack_trace.html added

Flup stack trace for the django's debug system unicode decode error

comment:1 Changed 7 years ago by anonymous

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Summary: Django fails to show non-latin exception messages from PosgreSQL running on FastCGIDjango fails to show non-latin exception messages from PostgreSQL running on FastCGI

comment:2 Changed 7 years ago by anonymous

Component: UncategorizedCore framework

comment:3 Changed 7 years ago by anonymous

Version: 1.01.1-beta-1

comment:4 Changed 7 years ago by Russell Keith-Magee

Triage Stage: UnreviewedAccepted

comment:5 Changed 5 years ago by Julien Phalip

Severity: Normal
Type: Bug

comment:6 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:7 Changed 5 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:8 Changed 5 years ago by Claude Paroz

For better readability, here is the traceback contained in the attached html error page:

Traceback (most recent call last):
	  File "/var/lib/python-support/python2.6/flup/server/fcgi_base.py", line 558, in run
	    protocolStatus, appStatus = self.server.handler(self)
	  File "/var/lib/python-support/python2.6/flup/server/fcgi_base.py", line 1116, in handler
	    result = self.application(environ, start_response)
	  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 239, in __call__
	    response = self.get_response(request)
	  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 128, in get_response
	    return self.handle_uncaught_exception(request, resolver, exc_info)
	  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 148, in handle_uncaught_exception
	    return debug.technical_500_response(request, *exc_info)
	  File "/usr/local/lib/python2.6/dist-packages/django/views/debug.py", line 39, in technical_500_response
	    html = reporter.get_traceback_html()
	  File "/usr/local/lib/python2.6/dist-packages/django/views/debug.py", line 97, in get_traceback_html
	    'exception_value': smart_unicode(self.exc_value, errors='replace'),
	  File "/usr/local/lib/python2.6/dist-packages/django/utils/encoding.py", line 35, in smart_unicode
	    return force_unicode(s, encoding, strings_only, errors)
	  File "/usr/local/lib/python2.6/dist-packages/django/utils/encoding.py", line 70, in force_unicode
	    raise DjangoUnicodeDecodeError(s, *e.args)
	DjangoUnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128).
        You passed in ProgrammingError('\xd0\x92\xd1\x8b\xd1\x80\xd0\xb0\xd0\xb6\xd0\xb5\xd0\xbd\xd0\xb8\xd1\x8f SELECT DISTINCT ON \xd0\xb4\xd0\xbe\xd0\xbb\xd0\xb6\xd0\xbd\xd1\x8b \xd1\x81\xd0\xbe\xd0\xb2\xd0\xbf\xd0\xb0\xd0\xb4\xd0\xb0\xd1\x82\xd1\x8c \xd1\x81 \xd0\xb8\xd0\xb7\xd0\xbd\xd0\xb0\xd1\x87\xd0\xb0\xd0\xbb\xd1\x8c\xd0\xbd\xd1\x8b\xd0\xbc\xd0\xb8 \xd0\xb2\xd1\x8b\xd1\x80\xd0\xb0\xd0\xb6\xd0\xb5\xd0\xbd\xd0\xb8\xd1\x8f\xd0\xbc\xd0\xb8 ORDER BY\n',) (<class 'psycopg2.ProgrammingError'>)

comment:9 Changed 5 years ago by Claude Paroz

Resolution: duplicate
Status: newclosed

This is quite certainly a duplicate of #12302, which should be fixed.

Note: See TracTickets for help on using tickets.
Back to Top