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>
_______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
