(I'd meant to add a ? at the end of my Subject: line. I don't know that this
is a race condition, but it sure seems to be one.)

Also, I'd forgotten about seeing this message on the Cherokee email list
(password required) :
http://lists.octality.com/private/cherokee/2010-August/013339.html

<http://lists.octality.com/private/cherokee/2010-August/013339.html>In that
message, Roberto wrote:

You are running the development version of uWSGI that got a rewrite of
SCRIPT_NAME/PATH_INFO handling that is still not complete.



> Rewrite your xml file in this way (this way is full backward compatible with 
> the current stable versions)



> <uwsgi>

        <pythonpath>/var/www/streamy/</pythonpath>

        <pythonpath>/var/www/</pythonpath>

       <module>django_wsgi</module>

</uwsgi>


I tried this just now, and it worked too. I'd overlooked it because I wasn't
using the dev version, but the released 0.9.6; so I wasn't sure if Roberto's
suggestion applied to my situation.

My original uwsgi.xml file looked like this:

<uwsgi>

    <pythonpath>/home/cherokee/django</pythonpath>

    <pythonpath>/home/cherokee/django/mysite</pythonpath>

    <pythonpath>/var/www/</pythonpath>

    <app mountpoint="/">

        <script>django_wsgi</script>

    </app>

</uwsgi>


and the new version:

<uwsgi>

    <pythonpath>/home/cherokee/django</pythonpath>

    <pythonpath>/home/cherokee/django/mysite</pythonpath>

    <pythonpath>/var/www/</pythonpath>

    <module>django_wsgi</module>

</uwsgi>


However, if the old syntax is still officially supported, and if there's a
chance that the same race condition exists in the new code (assuming it
*was* a race condition) then I'd suggest that this needs some further
investigation. I'll be glad to help if I can.

-- Dan

On Wed, Sep 15, 2010 at 3:35 PM, Dan Breslau <[email protected]> wrote:

I've been teaching myself Django, and recently tried running the Django
> tutorial (http://docs.djangoproject.com/en/dev/intro/tutorial01/) under
> Cherokee 1.0.8 using uWSGI 0.9.6. (The tutorial creates a site named
> /polls.) Most of the attempts I made to browse the site resulted in the
> error message "uWSGI Error: wsgi application not found". The uWSGI log file
> showed a strange message; either "ImportError: No module named ____" (where
> ____ was usually non-ASCII gibberish) or "ValueError: Empty module name". I
> did find that with some configurations of Cherokee and uWSGI, if I rooted
> the application to /polls in uwsgi.xml, I could then access it by browsing
> to /polls/polls, but that makes no sense!
>
>
> After checking, double-checking, and triple-checking my configuration, I
> started thinking that this was a memory management issue (possibly a race
> condition) inside of uWSGI, which was corrupting the name of the
> application's Python module. I tried running uWSGI under Valgrind, but the
> problem didn't occur under Valgrind (possibly because Valgrind serializes
> the threads.)  That is, I could browse the website as I'd expected to all
> along, albeit slowly ;-)  At least now I could be sure that this wasn't
> simply a configuration problem. Using gdb, I confirmed that the string
> pointed to by wsgi_req->wsgi_script was being corrupted. As a test, I
> located the lines in the source code where that field was being set, and
> modified them to use strdup() to copy the string. Voila -- it worked like a
> charm (aside from the memory leak that I'd introduced.)
>
>
> Yesterday, I saw the announcement for the 0.9.6.1 release. I tried it,
> and found that it doesn't show the same problem (that is, it works as well
> as my hacked version does.)  However, I don't see a specific fix for this
> bug in the release notes. I haven't studied the source well enough to
> understand the root cause of the problem, so I don't know whether it is in
> fact gone in 0.9.6.1. Hence I'm concerned that the bug may reappear as a
> problem for other folks.
>
>
> By the way, I'm using Python 2.6.5 on a Pentium Core 2 Duo.
>
>
> --
>
> Dan Breslau
>
> [email protected]
>
> http://www.outof*what*box.com <http://www.outofwhatbox.com>
>



-- 

Dan Breslau

[email protected]

<http://www.outofwhatbox.com>http://www.outofwhatbox.com
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to