Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Duplicate entry error in jump.cgi

Quote Reply
Duplicate entry error in jump.cgi
I seem to have a knack for finding the tough ones...

I just ran across a link in my database that when clicked on spits out the following error:
Quote:
Software error:

DBSQL (7001): Fatal Error: Unable to execute query: INSERT INTO Hits_Track (LinkID, IP) VALUES (2551, '24.4.254.139'). Reason: Duplicate entry '2551' for key 2 at jump.cgi line 82

For help, please send mail to the webmaster (webmaster@run-down.com), giving this error message and the time and date of the error.
2551 is the correct link id#, and I cannot see anything wrong with it. It is the only link that I have seen that is doing this, although there are potentially 5,000 more to check...

You can see it as the first result at (UK Running Track Directory):
http://run-down.com/...ning+Track+Directory
Nothing about it is different than any other links that are working fine, as far as I can tell. It gives the same error when you click on it from its category (as opposed to the search page).

Any ideas? I'll be trying the new verify feature soon (couldn't get very far with the Links 2 verify), so that may uncover others.

Dan
Quote Reply
Re: Duplicate entry error in jump.cgi In reply to
One of two things --

You changed the .def file or database definition.

Or, more likely, you made a change to jump.cgi so it's not properly exectuing the test block that first checks to see if the entry exists before trying to update the hits table.

The hits table needs a compound key, such that LinkID and IP are not individually uniqute, but the combination of a LinkID-IP _is_ unique.

What it seems to be doing is attempting to input the second hit on the link as a "hit"

Check your .def files and make sure they are not individually "unique"

------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: Duplicate entry error in jump.cgi In reply to
Thanks for the reply.
Code:
%db_def = (
LinkID => ['1', 'INT', '10', '20', '1', '0', '^\d*\.?\d*$'],
IP => ['2', 'CHAR', '25', '25', '1', '', ''],
Created => ['3', 'DATETIME', '20', '20', '0', '', '^\d{4}\-\d{2}\-\d{2}\s*\d{2}\:\d{2}\:\d{2}$']
);
And $db_key = 'IP';

Anything look wrong?

Thanks,
Dan


[This message has been edited by Dan Kaplan (edited February 25, 2000).]
Quote Reply
Re: Duplicate entry error in jump.cgi In reply to
Either this is the world's biggest coincidence, or there is something funny going on here...

I have found one other link that is behaving the same way, and it just so happens to be right next to it in the category listing:

http://run-down.com/Other/Regional/Europe/

The Athletics Site
UK Running Track Directory

toward the bottom of the page are the two with the problem. I have checked quite a few other links, and those are the only two that I have found with a misbehaving jump.cgi...

Dan
Quote Reply
Re: Duplicate entry error in jump.cgi In reply to
Now I'm even more confused. I'm away from home at the moment and decided to check those problem links from a different computer. On this computer, every link in that category has that error!

What would the computer/browser/category have to do with anything? I was testing with Netscape on my computer before, and am now looking at it with IE. Anyone else notice it one way or the other?

I don't see anything wrong with the setup for that particular category...

Dan
Quote Reply
Re: Duplicate entry error in jump.cgi In reply to
The error occurs when you try to visit the link a second time....

That's why it has to be in the configuration of the database or the .def files.

Once the IP address is entered into the hits tracking, you will get that error on each re-visit.

That's why I suggested check those two areas.

Without getting to look at the def files and your database, it's hard to tell.



------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: Duplicate entry error in jump.cgi In reply to
Hmm, I see what you're saying now. I was thrown off by the fact that the different computer I was testing on today was having this problem with the first hit to any given link in that category, but not in other categories... That makes no sense, but it's what was happening.

What would you need to see in the .def file, other than what I posted from Hits_Track.def up above? And if I can format this half legibly, here's what I've got in Hits_Track in the database:
Code:
Field Type Attributes Null Default Extra
LinkID int(10) UNSIGNED No 0
IP char(25) No
Created timestamp(14) Yes
Code:
Keyname Unique Field
cndx No Created
PRIMARY Yes LinkID
LinkID Yes LinkID
Does that help any?

Thanks,
Dan


[This message has been edited by Dan Kaplan (edited February 26, 2000).]
Quote Reply
Re: Duplicate entry error in jump.cgi In reply to
It helps a lot....

Heres my hits_track.def

<BLOCKQUOTE><font size="1" face="Verdana, Arial">code:</font><HR><pre>
# Auto Generated Config File.
# Created on: Sat Nov 27 02:52:50 1999
#

package Links: Smile



------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: Duplicate entry error in jump.cgi In reply to
That certainly looks to be the source of the problem. One more little question, how do I go about fixing it...? Wink

I suppose another question -- any ideas how the table def could have gotten like that? I didn't notice the problem when I first started testing the database, although I may not have clicked on a link more than once as that's not what I was testing... The closest I came to the hits_track table was emptying it (through phpMyAdmin) before re-importing.

Is there any documentation on how to get the tables set up from scratch and/or to correct mistakes such as these?

Thanks,
Dan
Quote Reply
Re: Duplicate entry error in jump.cgi In reply to
No... don't know how it might have happened, but the easiest way is to simply drop the table Hits_Track and then cut the piece of code I gave (to create table) into the SQL monitor and it should create the table for you (it's actually the table definition).

Then try out the links and see if it fixes the problem.

You'll know as soon as you make the new table if it's working.



------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: Duplicate entry error in jump.cgi In reply to
That worked! Thanks a million!!! I didn't realize the code you posted was intended for the SQL monitor. I was trying to match it up with what phpMyAdmin was showing...

I'll have to keep an eye on this, but something looked a bit strange. I built the database before dropping the Hits_Track table. After the build, I looked at the table in phpMyAdmin, and it hadn't removed the 350 or so records (hits) from the table. Shouldn't those have been removed during the build? Just wondering if there's a deeper problem.

Thanks again for all the patience and help! Smile

Dan
Quote Reply
Re: Duplicate entry error in jump.cgi In reply to
phpMyAdmin has a few problems....

The only way to make sure it is what's really there is to hit shift-refresh on the browser, and reload the whole frame set.

The Hits_Track _won't_ disappear after a build, because the purpose is to prevent duplicate hits from the same person. It will age out at whatever is set in the file. I'm not sure, but it's at least every 24 hours, it might be every 6 or 8 hours. Most people only build the site daily, so that's about what the default probably is.

If you only build your site once a day, you might want the time-out to be 8 or 10 hours, to allow as many IP's to be recycled. on a build as makes sense.... Never checked what the time-limit on the duplicate hits was.




------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: Duplicate entry error in jump.cgi In reply to
Hello all,

I was having the same problem as Dan, and I just found this thread.

I get the following error:

DBSQL (16638): Fatal Error: Unable to execute query: INSERT INTO Hits_Track (LinkID, IP) VALUES (2803, '212.127.151.61'). Reason: Duplicate entry '2803-212.127.151.61' for key 1 at /home/user/cgi-bin/jump.cgi line 82

But, only certain times, not always. Looking at the error log on my server, there are a number of similar errors for many different links.

Looking at the configuration of my database, and Hit_Track.def file, they are the same as the ones by pugdog, and I did not change jump.cgi.

My only guess is that the problem occurs when the traffic gets heavy (ie. MySQL database problem).

Does anyone have any idea how to tackle this problem?

Thanks in advance.

5th season.

Quote Reply
Re: Duplicate entry error in jump.cgi In reply to
Ok,

I don't think it's a mysql problem. Though, it could be, if the server was very over loaded, and the MySQL queue was very large, it's possible that the same person could click the link twice before the database was updated.

I'm not sure of the details of the MySQL queue, _but_ logically, the two requests would _still_ be separated by a "request" for whether the record already exists.

You can check it by hitting a link several times through jump.cgi at different times of the day, then checking the log to see if your IP generates an error sometimes, or all the time.

This error would_only_ be generated if a person tries to hit the same link twice in 24 hours, from the same IP, but it should be screened out and handled before the error is actually generated.

Try forcing the error as above, and if you can duplicate it every time, it's a table or code problem. If it only occurs at certain times, it may very well be a load problem with your ISP.





http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Duplicate entry error in jump.cgi In reply to
Thanks pugdog for your valuable input.

>Try forcing the error as above, and if you can duplicate it every time, it's a table or code problem. If it only occurs at certain times, it may very well be a load problem with your ISP.

Yes, I have tried to duplicate the error several times, but it didn't happen for that particular link 2803. Actually, the above error was reported by a site visitor. That makes me believe it is a load problem.

Our site is hosted on a dedicated server, with Linux 6.1, 500 MHz, 256 MB RAM, and uses MySQL 3.22.xx.

Our site currently gets about 4,000 users with 30,000 page views a day. Now, it is not a small site, but I don't think the amount of traffic is large enough to cause such a load problem. I am considering upgrading RAM or MySQL to a newer version, but would it easy up the load possibly? Or is there any other way to get around the problem?

Thanks in advance.

5th season


Quote Reply
Re: Duplicate entry error in jump.cgi In reply to
I'm doing at least 2x that volume, plus running a very active mail server, and I've never seen that problem.

Did you try duplicating it with other links? Seeing if you can create the problem by hitting the link twice in a row?

If you have a log program, and you can find when your buisiest time of day is, try it then, beating up your links to see if you can duplicate it.

I have a hard time believing it's a MySQL problem. I could imagine this sort of problem if it was due to simultaneous access (like flat-file access locking).

If the jump.cgi was modified, or if your indexes were modified, then you'd expect to be able to reproduce the problem repeatedly.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/