Re: SystemError from django.conf.settings

2011-05-30 Thread Ian Clelland
On Sat, May 28, 2011 at 10:50 PM, Cameron wrote:

> So I have this stack trace on my production server. I can't reproduce
> it locally and it doesn't occur with an older version of the same site
> deployed on the same server.
>
> Traceback (most recent call last):
>  File "./dependencies/django/core/handlers/wsgi.py", line 222, in
> __call__
>from django.conf import settings
> SystemError: ../Objects/tupleobject.c:118: bad argument to internal
> function
>


> 1. Anyone seen this before? The only other reference that I can find
> to that line of python is here (http://bugs.debian.org/cgi-bin/
> bugreport.cgi?bug=581626)
>

I've never seen this before. Looking at the Python source (you mentioned
that you're running 2.5.2 from Debian lenny,) this looks to me like it has
to be an error in a C module somewhere -- probably a third-party module, but
it's possible it's in the Python core somewhere.

The line itself is a sanity check in PyTuple_SetItem, which shouldn't even
be available to Python code (tuples are supposed to be immutable, right?) It
would only get triggered if it got called somehow with an argument that
wasn't actually a tuple, or with a tuple for which another reference existed
somewhere (besides in the initializing code).


>
> 2. Any tips on how I can find out what has changed to cause it? Aside
> from rolling back through weeks of revisions to find what triggered
> it.
>

If it's happening on settings import, then try importing settings manually
from a python shell. You may see more of a stacktrace that way. If you still
get the error, but can't pinpoint the failing line, then try running it
through the debugger, and step from line to line until you see it. If you're
lucky, there will be call to a function in an external module that triggers
it, and you'll be able to narrow the possibilities down to that one module.

Failing that, a binary search through weeks or even months of revisions
should only take O(lg n) time -- a small consolation, but searching weeks of
development is only a couple of iterations more than searching a few days.


> 3. I am about to try upgrading python to a newer version, is that
> likely to make any difference? I have already tried 2 different
> versions of uwsgi (0.9.6.8 and 0.9.7.2), but I don't want to mess
> around with the production environment too much, or risk breaking the
> live sites.
>

If the error is in one of the python core modules, then it may have been
fixed recently; but I haven't seen any reports of failures in tupleobject.c
other than the Trac bug that you turned up. See if there are any other
compiled modules in the system that you can update first.


-- 
Regards,
Ian Clelland


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: SystemError from django.conf.settings

2011-05-30 Thread Cameron
Yeah no worries, I will gather as much evidence as I can and post the
details tonight. FYI I am running python 2.5.2 which comes with debian
lenny, I did not compile it myself.

And yes you are right that the wsgi server plays such a small part in
the processing of a django page. The majority of my CPU time is spent
with the database and rendering views.

Which makes gunicorn an interesting option being pure python, but
overall not that important in terms of performance. I had just setup
the uwsgi Emperor mode which was very convenient so I will miss that.
My hacked together init.d script equivalent for gunicorn is not as
clean.

-
Cameron

On May 30, 2:15 pm, "Roberto De Ioris"  wrote:
> > As suggested on #django yesterday I swapped the site over to manage.py
> > runserver and also tried gunicorn and they are both stable so it looks
> > like a problem with uwsgi.
>
> As already suggested it looks like a Python c api problem, do you mind to
> fill a bug report in the uWSGI wiki with all the relevant information ?
> (mainly how python is compiled, as most of the time this kind of errors
> are related to python excessive optimizations)
>
>
>
> > Gunicorn is also surprisingly fast, beating uwsgi on a httperf test to
> > one of the heavier pages on the site.
>
> oh yes, and you will see tons of comparison reporting the opposite, others
> showing mod_wsgi is better and so on... Please try to understand that WSGI
> bridges/gateways/servers are pratically irrelevant in your app
> performance.
>
> Gunicorn works for you ? Perfect ! you have found your WSGI server ;)
>
> --
> Roberto De Iorishttp://unbit.it

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: SystemError from django.conf.settings

2011-05-30 Thread Roberto De Ioris

> As suggested on #django yesterday I swapped the site over to manage.py
> runserver and also tried gunicorn and they are both stable so it looks
> like a problem with uwsgi.


As already suggested it looks like a Python c api problem, do you mind to
fill a bug report in the uWSGI wiki with all the relevant information ?
(mainly how python is compiled, as most of the time this kind of errors
are related to python excessive optimizations)

>
> Gunicorn is also surprisingly fast, beating uwsgi on a httperf test to
> one of the heavier pages on the site.


oh yes, and you will see tons of comparison reporting the opposite, others
showing mod_wsgi is better and so on... Please try to understand that WSGI
bridges/gateways/servers are pratically irrelevant in your app
performance.

Gunicorn works for you ? Perfect ! you have found your WSGI server ;)

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: SystemError from django.conf.settings

2011-05-29 Thread Cameron
As suggested on #django yesterday I swapped the site over to manage.py
runserver and also tried gunicorn and they are both stable so it looks
like a problem with uwsgi.

Gunicorn is also surprisingly fast, beating uwsgi on a httperf test to
one of the heavier pages on the site.
-
Cameron


On 29 May, 21:48, А. Р. <4d876...@gmail.com> wrote:
> 2011/5/29 Cameron 
>
>
>
> >    from django.conf import settings
> > SystemError: ../Objects/tupleobject.c:118: bad argument to internal
> > function
>
> Seems to me as a Python bug, not something wrong in Django, so upgrading to
> newer Python version may help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: SystemError from django.conf.settings

2011-05-29 Thread А . Р .
2011/5/29 Cameron 

>
>from django.conf import settings
> SystemError: ../Objects/tupleobject.c:118: bad argument to internal
> function
>
>
Seems to me as a Python bug, not something wrong in Django, so upgrading to
newer Python version may help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



SystemError from django.conf.settings

2011-05-29 Thread Cameron
So I have this stack trace on my production server. I can't reproduce
it locally and it doesn't occur with an older version of the same site
deployed on the same server.

Traceback (most recent call last):
  File "./dependencies/django/core/handlers/wsgi.py", line 222, in
__call__
from django.conf import settings
SystemError: ../Objects/tupleobject.c:118: bad argument to internal
function

Some details:
 - nginx 0.8.54
 - uwsgi 0.9.7.2
 - django 1.3 (previous version which is working is 1.2.5)
 - python 2.5.2
 - debian 5.0.8

Since the older deployment which is running fine I have added some new
apps:
 - django.contrib.comments
 - south
 - cumulus
 - pagination
 - taggit
 - djangoratings
 - compressor

Plus added a few extra custom settings for the various apps. So on
with the questions:

1. Anyone seen this before? The only other reference that I can find
to that line of python is here (http://bugs.debian.org/cgi-bin/
bugreport.cgi?bug=581626)

2. Any tips on how I can find out what has changed to cause it? Aside
from rolling back through weeks of revisions to find what triggered
it.

3. I am about to try upgrading python to a newer version, is that
likely to make any difference? I have already tried 2 different
versions of uwsgi (0.9.6.8 and 0.9.7.2), but I don't want to mess
around with the production environment too much, or risk breaking the
live sites.

Cheers-

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.