Re: Getting random "Internal Server Errors"
by przemo (Scribe) on May 05, 2009 at 18:21 UTC
|
I don't think the browser makes up the error. So there is something wrong going on the server side. Unfortunately, without logged messages it is hard to say what it might be.
Are you sure that error logging is fine? Try running a simple perl script as CGI which just dies as look at the log. If there is still nothing in there, I'd suspect wrong (or against your expectations) Apache configuration.
| [reply] |
|
|
I agree with you. I'm sure the browser doesn't make stuff up... ;)
Error logging works. I tried that by adding faulty stuff to the script and the stuff really shows up within the log.
I somehow get the feeling it's got to do something with the interaction prototype<->perl script. If i run the perl script directly off the command line with the several POST arguments as cl-arguments, i get no errors at all. It always shows the expected behaviour.
Has anybody of you ever worked with prototype and perl and knows where this error could come from?
| [reply] |
Re: Getting random "Internal Server Errors"
by Herkum (Parson) on May 05, 2009 at 19:01 UTC
|
It can always be a problem with the request being sent to the server. Are your sure it is your perl-script that is receiving the request instead of it going somewhere else? I mean it could be trying to call a different script than what you thought, or possibly a different web server. There is also a possibility that there is a problem with a proxy server.
Chances are that this is probably not a perl script issue as it is an environment issue.
| [reply] |
|
|
I agree, this is most probably an environment issue, but i just don't know where else to search, that's why i'm asking and appreciating every single answer...
I can quite surely exclude a wrong script or wrong server. I called the prototype-ajax-object with the full URL to the perl script that should handle the request. I can also exclude a proxy since i'm only testing this on my home server within my local network. The requests don't pass any proxies on their way...
| [reply] |
|
|
| [reply] |
|
|
|
|
One more thing that proves that the request is sent to the right script: As i wrote the script gets executed EVEN in the cases i get the error! The script starts/stops some services and even if i get the error, i can see that the services have been started/stopped just as they should.
In other words: The script is executed EVERY time it is called, it just randomly exits with the appearance of not having been successful...
| [reply] |
Re: Getting random "Internal Server Errors"
by ig (Vicar) on May 05, 2009 at 21:39 UTC
|
"500 Internal Server Error" may result from an error in your CGI script but it may also result from a fault in your web server (apache?, IIS?, something else?). If the server is returning a 500 status to the browswer but not logging anything in its error log then I would say that it is broken or misconfigured. You should fix the server so that it logs useful information before struggling with possible CGI script errors.
The fact that a script containing nothing but a print of a hard coded string sometimes fails suggests very strongly that your web server is broken.
| [reply] |
|
|
Webserver is lighttpd. Just checked the config again and i can't find any stuff that could be wrong or at least cause problems. Can you give me an idea where to start?
| [reply] |
|
|
| [reply] |
|
|
|
|
|
Re: Getting random "Internal Server Errors"
by Anonymous Monk on May 05, 2009 at 20:08 UTC
|
| [reply] |
|
|
Thanks for trying to help, but you should really read before writing...
1. I already mentioned that the script running as standalone produces no errors, only in connection with an AJAX-request
2. I already mentioned, that if i actively add errors, they are shown in the server log. Even the link you posted says "You could look in the server logs to get the same information..."
3. Because of 1 and 2 we can assume the script itself is ok and the problem is somewhere in the surroundings as somebody already stated
| [reply] |
|
|
BEGIN {
$|=1;
print "Content-type: text/html\n\n";
use CGI::Carp('fatalsToBrowser');
}
Or add this
BEGIN {
use CGI::Carp qw(carpout);
open(ERROR_LOG, ">>my_error_log")
or die("my_error_log: $!\n");
carpout(\*ERROR_LOG);
}
| [reply] [d/l] [select] |
|
|
|
|
|
Re: Getting random "Internal Server Errors"
by polki (Novice) on May 06, 2009 at 00:04 UTC
|
The reason i still doubt this to be any problem of the webserver is, that any perl script works just fine if called directly from the webserver. The errors only happen if any script is called via an ajax-request... | [reply] |
|
|
The reason i still doubt this to be any problem of the webserver is...
That doesn't make sense.
Either your program or your webserver prints
Status: 500
You've convinced us its not your program, so it must be your server. | [reply] [d/l] |