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?
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.
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.
Related
Looking at the docs, all the logging paths specified for console-capture and requestlog are relative to jetty.base, normally in $jetty.base/logs . That's ok for many purposes but, I really want logs to go into /var/logs/jetty , just like a lot of other processes would do. I've tried setting this in console-capture as /var/log/jetty, but that just tries to save log files in $jetty.base/var/log/jetty, which isn't what I need.
Is there some way to do this? I'm looking for the simplest possible approaches to saving logs. This is the last thing I need to do before my Jetty installation is fully in production. Overall it's been great. This is all with Jetty 9, latest release, on Ubuntu.
Start by not using console-capture.
You have progressed beyond the limited scope of console-capture with your requirement.
You'll want a formal logging framework, pick one, like "logback" (which the Jetty devs recommend), or java.util.logging, or log4j.
Use one of the logging-* modules to setup Jetty's server classpath to start using that logging library.
Now configure that logging library (example: if you are using "logback", the file ${jetty.base}/resources/logback.xml is what you configure)
Finally, configure your access logging to use slf4j.
Boom, all of your logging is now going to your logging library of choice, and it's configuration can be used to slice / dice / roll over / filter / etc the logging in any way you want.
You can have it split into different logging output files, combine them into one, roll on different rules (size, number of lines, duration, time, etc).
Definitely made some progress on this. For some reason, console redirect was taking the absolute path correctly while the request logger was not. For that, I made my configuration relative: ../../../var/log/jetty
This seems like a clunky way to do it but it does seem to work. I'm still getting a failure on startup but weirdly enough it's running fine and I don't see exceptions so I need to figure that out now.
I have a lot of trouble in debugging an ajax view. That's a view which expects a post request and then returns a json object. It causes an internal error 500, but eclipse doesn't give more information. The standard debug page cannot be accessed, because the view redirects if there is no post data.
What is the best approach to tackle these problems? Can I get eclipse/pydev to just tell me what the internal error 500 exactly is? Or do I really have to get a browser plugin and construct POST Data? (Which might be difficult, because a file upload is involved.)
Effectively I'm looking for a way to get the exception message in the console. Currently it just says:
[16/Feb/2015 17:38:03] "POST /fotos/upload/ HTTP/1.1" 500 10907
Which is not a big help.
Important: This question is about how to make debugging easier and not about fixing this particular view. So no need to ask for code or logfiles of that view. It's a general question about how to go ahead.
Thank you for your time!
Internal server errors can be generated in many ways. One of the most prominent ways is having a syntax error in the server code. The syntax error can range from typos to incorrect indentation(in python). Try debugging your python code. Try to find the point of error and see if there is a misspell or indentation error like using tabs instead of spaces(or vice-versa).
Also, if you're running Django in debug mode, open the link giving the error in a browser, and it will directly show you if there are any compile time errors in the code.
EDIT: And I totally missed the part where you mentioned that "the standard debug page cannot be accessed". Well in that case I'd resort to using standard print statements for debugging and check server logs for the point of failure.
Put a breakpoint (click on the left of the line or just tight click add Breakpoint to the spot). Once the source code gets to the point a debugging menu is opened containing:
-Variables and their values
-All your breakpoints
I am on a four month coop with a web development firm, and am currently trying to implement some new functionality to their project management tool. I have the source and am trying to get it set up locally for testing purposes.
I am using windows 7 and wamp.
I have spent the entire day today failing with this, have found dozens of similar (potentially identical) questions on stack overflow which have not assisted me, and read the documentation on the php.ini that seemed related.
The code - not mine - uses a constant ROOT value which I have set to work with my structure.
define('ROOT', '/ac_test/public_html/||||'); (|||| is just the software they use).
When I load up the index.php file it attempts to include a file:
require_once ROOT . '/defaults.php';
At this point it fails and gives me this error:
Warning: require_once(/ac_test/public_html/**/defaults.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\ac_test\public_html\config\defaults.php on line 14
Fatal error: require_once() [function.require]: Failed opening required '/ac_test/public_html/||||/defaults.php' (include_path='*PATH ATTEMPTS BELOW') in C:\wamp\www\ac_test\public_html\config\defaults.php on line 14
I have altered the include_path in my php.ini file to be just about everything. I've attempted relative paths (.;..;../../../.. etc), I have attempted direct paths (c:/wamp/www for example) and probably 20+ other nonsensical possibilities. I have used get_include_path() to output the path which ends up being identical to where the file is, and I have used the full, direct path without using ROOT, and it works, but I can't use that. There are hundreds of coded references in the code that require me to use the ROOT constant and for the include_path to function.
I realize this question has been asked before, many many times. I've likely read every post on stack overflow today regarding it. They're all similar. So is mine, but I'm out of ideas. I should also mention that I began web development and php only 2 months ago with this coop. I have some very big holes in my knowledge, and so I may have overlooked something very simple.
I have a weird situation regarding this wiki:
http://www.dvartora.com/Wiki/en/index.php?title=TestPage
This wiki is version 1.16.0
If I add the word "free"(so it will write: "Avast! Free Antivirus"(without quotes)) between the 2 words and try to save it says I am forbidden.
Forbidden
You don't have permission to access
/Wiki/en/index.php on this server.
Additionally, a 404 Not Found error
was encountered while trying to use an
ErrorDocument to handle the request.
You can try it for yourself to see the result.
During installation I had a problem, that I bypassed doing a local install and uploading to the server, that it said I am forbidden(the same error).
I added the word "free" successfully. However, "Free Antivirus" does not work but "Free stuff" does.
Looking at the version they have no unusual extensions added.
So it seems likely that Treffynnon is correct - but I can't find the functionality. =:-(
today I ran into an error and have no clue how to fix it.
Error: App with label XYZ could not be found. Are you sure your INSTALLED_APPS setting is correct?
Where XYZ stands for the app-name that I am trying to reset. This error shows up every time I try to reset it (manage.py reset XYZ). Show all the sql code works.
Even manage.py validate shows no error.
I already commented out every single line of code in the models.py that I touched the last three months. (function by function, model by model) And even if there are no models left I get this error.
Here http://code.djangoproject.com/ticket/10706 I found a bugreport about this error. I also applied one the patches to allocate the error, it raises an exception so you have a trace back, but even there is no sign in what of my files the error occurred.
I don't want to paste my code right now, because it is nearly 1000 lines of code in the file I edited the most.
If someone of you had the same error please tell me were I can look for the problem. In that case I can post the important part of the source. Otherwise it would be too much at once.
Thank you for helping!!!
I had a similar problem, but I only had it working after creating an empty models.py file.
I was running Django 1.3
Try to clean up all your build artifacts: build files, temporary files and so on. Also ./manage.py test XYZ will show you stack trace. Later try to run python with -m pdb option and step through the code to see where you fail and why.
You don't specify which server you're using. With Apache you'll almost certainly need a restart for things to take effect. If you're using the development one try restarting that. If this doesn't work you may need to give us some more details.
I'd also check your paths as you may have edited one file but you may be using a different one.
Plus check what's still in your database, as some of your previous versions may be interfering.
Finally as a last resort I'd try a clean install (on another django instance) and see if that goes cleanly, if it does then I'd know that I'd got a conflict, if not then the problem's in the code.