request_finished signal not being called with Django 1.5.1 with uwsgi

262 views
Skip to first unread message

Lewis Sobotkiewicz

unread,
Apr 10, 2013, 7:55:51 PM4/10/13
to django...@googlegroups.com
Hi there,

I'm noticing some strange behaviour with Django 1.5.1 and uwsgi - The builtin signal django.core.signals.request_finished isn't being triggered. I've tried various versions of uwsgi, and they all have the same behaviour.

Also, when I downgrade to Django 1.4.5, the normal behaviour resumes.

Any idea why this might be happening? It's causing my DB connections to remain open after a request.

Lewis Sobotkiewicz

unread,
Apr 11, 2013, 7:28:42 PM4/11/13
to django...@googlegroups.com
So figured it out.

Apparently Ubuntu 12.04 packages uwsgi 1.0.3 in their apt repository, which doesn't support calling close() on the WSGI application object returned by Django. I had installed that uWsgi version, then installed a more up-to-date version with pip. ie.

pip install uwsgi==1.4.4

Subsequently, running uwsgi from the command line gives the later version:

$ uwsgi --version
1.4.4

However, when starting uwsgi with /etc/init.d/uwsgi, it was using Ubuntu's older, pre-packaged version. I assumed that pip would overwrite that version. Silly me. Fixed by editing /etc/init.d/uwsgi to point DAEMON=/usr/bin/uwsgi to the version installed by pip.

ja...@eight.nl

unread,
May 31, 2013, 11:10:16 AM5/31/13
to django...@googlegroups.com
I've created a ticket https://code.djangoproject.com/ticket/20537

Not sure if this can be fixed in Django or a stern warning in the documentation can suffice.

Op donderdag 30 mei 2013 17:15:29 UTC+2 schreef ja...@eight.nl het volgende:
I'm being hit by the same issue. I don't really understand why it worked with older versions of Django though? That seems to be a bug.

Op vrijdag 12 april 2013 01:28:42 UTC+2 schreef Lewis Sobotkiewicz het volgende:

Roberto De Ioris

unread,
May 31, 2013, 11:19:12 AM5/31/13
to django...@googlegroups.com

> I've created a ticket https://code.djangoproject.com/ticket/20537
>
> Not sure if this can be fixed in Django or a stern warning in the
> documentation can suffice.


Honestly (i am the main uWSGI author) whoever is using a uWSGI version <
1.2.6 should be worried by dozens more things (no more support, no more
security updates, known bugs, basically broken newrelic support, broken
threads and i do not even know what scary things you can find in it ...)

We are talking about a package of 2 years ago... and this specific problem
is caused by a (serious) bug in ancient uWSGI releases with WSGI specs, so
why django should bother ?


--
Roberto De Ioris
http://unbit.it

ja...@eight.nl

unread,
May 31, 2013, 2:40:43 PM5/31/13
to django...@googlegroups.com
The problem is mainly that the current LTS of Ubuntu ships this ancient version of uwsgi via apt. So it's very easy to end up with a system that's not capable of running Django 1.5 properly (sysadmins seem to prefer apt over pip). Seems sensible to at least specify the minimum uWSGI version in the docs, kind of like the minimum python version.
Reply all
Reply to author
Forward
0 new messages