views:

41

answers:

2

I've got a weird problem here: I'm getting a 500 error code from Apache serving a Django 1.1 application when the length of the path part of the URL given to Apache is in [23..26,30..33]. For example, http://server/012345678901234567890123 results in a 500 error while http://server/012345678901234567 does not.

Each 500 error also results in a "Request origin could not be validated." error message from mod_wsgi in the logs. The error doesn't occur on Apache-only URLs, like images, it only happens with Django.

Any idea why this could be happening?

A: 

Is it possible that this is an error somewhere in your app's code?

Change your apache settings for the site so that WSGI creates its own error log

LogLevel info
ErrorLog /tmp/error_log

Then run

tail -f /tmp/error_log

And try loading in one of your long URLs. Hopefully the error message will come up in the log file. At the very least, it should pinpoint what the real error is.

Jordan Reiter
A: 

Take this to the proper mod_wsgi list on Google Groups and detail what versions of Apache, Python and mod_wsgi you are using. Also indicate which Apache MPM you are using and any other non standard Apache modules you are using. Might be an idea to state whether using 32 bit or 64 bit applications as well.

This error is specific to daemon mode and occurs before it even gets to your WSGI application. Frankly the error should never happen unless there is a measure of memory corruption occurring or some very subtle one off error which for some reason has never occurred with the huge number of existing users.

There has been one other person report this recently. You though seem to have been able to tie it to a specific URL length, which hasn't been suggested before and is a clue at least.

Do note, about to go on holidays. You have less that 8 hours for me to have another serious look at it and after that going to be really hard until I get back.

Graham Dumpleton
Hmmm, maybe you are the same person as I found your comment on other SO question where you quote me already saying it shouldn't happen. As I said, the length of the URL being an issue is new, as is that you are using mod_ssl. Take new information to the mod_wsgi list. Also try same URLs without mod_ssl being involved. Maybe the corruptions is being caused by mod_ssl somehow.
Graham Dumpleton
Last comment here as really want this dealt with on mailing list and not IRC or SO. Instead of your big Django application, use echo application in 'http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Displaying_Request_Environment'. Validate that with mod_ssl some URLs fail. Then do it without mod_ssl to show that mod_ssl is contributing factor. Capture output from echo application for each successful URL. Then go to the mailing list and post results. I will then tell you code changes to make in mod_wsgi to skip the origin validation check so can see for broken URL what is received.
Graham Dumpleton
Here is the thread you can followup to. It includes instructions of what I need you to do to debug thus. http://groups.google.com/group/modwsgi/browse_frm/thread/d5f8523ffc50f045
Graham Dumpleton
Graham, thank you for you recommendatations. Due to time shift, it'd be difficult to react before you go on holiday ;) I would like to pinpoint this problem before I describe it vaguely on the mailing list, since I'm not 100% sure that mod_wsgi is at fault here. More debugging for me, exact error state for you.
rassie
If you can do what I ask in the mailing list post I referred to, that will be a good start and help me to at least understand what could cause it. Can then perhaps work out whether it is a mod_wsgi issue or an issue with mod_ssl, or something else. Take your time, I'll either be asleep or on a plane the next couple of days anyway. :-)
Graham Dumpleton