Opened 16 years ago

Last modified 15 years ago

#11015 closed

django-1.0.2 does not catch the exception that database backend first close the db connection. — at Version 1

Reported by: qingran Owned by: nobody
Component: Database layer (models, ORM) Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ramiro Morales)

I am running django-1.0.2 by fastcgi with nginx-0.6.36. Now I found out this error

message: Unhandled Exception
An unhandled exception was thrown by the application. 

And in nginx's error log I found:

--------------------------------------------
2009/05/06 01:03:21 [error] 14785#0: *290 upstream timed out (60: Operation timed out) while reading response header from upstream, client: 2.3.1.5, server: ui.zeuux.com, request: "POST /blog/user/qingran/post/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/fcgi.sock:", host: "mydomain", referrer: "http://ui.zeuux.com/blog/user/qingran/post/"sic/css/zeuux-com-component-editor.css HTTP/1.1", host: "mydomain", referrer: "http://mydomain/post/"

2009/05/06 01:05:14 [error] 14785#0: *368 FastCGI sent in stderr: "Traceback (most recent call last):
  File "/usr/local/lib/python2.5/site-packages/flup-1.0.1-py2.5.egg/flup/server/fcgi_base.py", line 558, in run
    protocolStatus, appStatus = self.server.handler(self)
  File "/usr/local/lib/python2.5/site-packages/flup-1.0.1-py2.5.egg/flup/server/fcgi_base.py", line 1116, in handler
    result = self.application(environ, start_response)
  File "/usr/local/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 246, in __call__
    signals.request_finished.send(sender=self.__class__)
  File "/usr/local/lib/python2.5/site-packages/django/dispatch/dispatcher.py", line 148, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/usr/local/lib/python2.5/site-packages/django/db/__init__.py", line 46, in close_connection
    connection.close()
  File "/usr/local/lib/python2.5/site-packages/django/db/backends/__init__.py", line 51, in close
    self.connection.close()
InterfaceError: connection already closed" while reading response header from upstream, client: 2.5.1.4, server: mydomain, request: "POST /post/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/fcgi.sock:", host: "mydomain", referrer: "http://mydomain/post/"
--------------------------------------------

At the same time I found out that my database backend firstly closed the connection because of the network program.

I think django should handle this exception by handler500, so I can give the vistor the error page. My enviorment is listed as follows:

  • OS: FreeBSD 6.2 release amd64
  • Python 2.5.2_2
  • Django 1.0.2
  • Database PostgreSQL 8.3.3
  • Webserver Nginx-0.6.36

Change History (1)

comment:1 by Ramiro Morales, 16 years ago

Description: modified (diff)

(wikified description)

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