Forum Moderators: coopster & phranque

Message Too Old, No Replies

500 Error sometimes

Perl script is failing sometimes when clicked from email

         

mdharrold

1:06 am on Oct 27, 2001 (gmt 0)

10+ Year Member



I have a script that builds a "custom" survey based on the query string. The data is stored and retrieved through the user number in the query string.
One customer is saying that the script is failing to create the survey when a link is clicked from email.
I have not been able to duplicate this problem, so my guess is either their email program is causing it to fail or their firewall is causing it to fail.
Is there some other reason it could fail?
I'm sure you will need more information but I don't know what else could cause it so I don't know what info to provide.

Thanks

mivox

1:11 am on Oct 27, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Could it be that their email program is "breaking" the link into two lines? I've seen that happen a lot with long urls... when the URL wraps onto the second line, any query string info in the second section is excluded from the clickable link.

In cases like that, the client would have to select/highlight both lines of the URL and then copy & paste it into their browser.

Otherwise, I've got not idea what's going wrong...

Brett_Tabke

1:14 am on Oct 27, 2001 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Add this string to the top of the script right after the perl line:

use CGI::Carp qw (fatalsToBrowser);

That will send most error messages to the browser. Atleast when it hits, your users can tell you the error. It will often include the line number in the script where the error occurred. Not ill or adverse efffects. (beats a server error message).

If you have a system server error log, try looking through it. Often the type of error or location of the error will get printed in the error log.

If those two fail, is there a place in the script where you can see it has done "some work" before the error? Have any files been updated before the error hits? Sometimes you can find errors that way simply by knowing where the error is occuring in the code.

After that, it gets pretty dicey and involved. Error tracking can be difficult and takes experience. Even then, you can stare at the bug for hours and not know it.

mdharrold

1:20 am on Oct 27, 2001 (gmt 0)

10+ Year Member



That is the problem Brett, the page does not even start. I get not error message in the log and all they receive is the 500 page.
The script they are accessing is just reading a flat file database that inputs their name here and there and changes some of the survey questions and answers based on how they originally set it up.
I can take the exact same url, send it to my self in email and click over with no problems.

One thing I thought was to use flock, but I have always heard that was for writing to files only. True/False?

Thank you

sugarkane

4:03 pm on Oct 27, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sounds like mivox's suggestion is the most likely contender. Try having the client forward their copy of the email to you, and see if the URL is being wrapped at their end.

> flock

It's good practice to use this with every file access, whether reading or writing. If the script writes to the file at all, you don't want another instance of the script to be reading it while it's being updated.

mdharrold

12:14 am on Oct 30, 2001 (gmt 0)

10+ Year Member



I have seen the email and it is not broken into two lines.
Is it possible the page is being hit more than once in very rapid succession which is causing the failure?
And if so, shouldn't I be getting an error in the log?

volatilegx

12:25 am on Oct 31, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's unlikely the script would be hit simultaneously by two different users every time your client tries to access it.

Maybe your client's email application isn't sending the query information from the link. Try building a routine into the script that handles instances where no query info is received.

Also, in the shebang line of your script (the first line) make sure you have the -w tag on to get the extra error logging turned on, like this:
#!/usr/bin/perl -w

mdharrold

12:39 am on Oct 31, 2001 (gmt 0)

10+ Year Member



I will try the -w. I think the problem is on their end because I can not make it fail for me. Supposedly their tech people are looking at the possibilities.

Thank you.