Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Truncated url.db via jump.cgi

Quote Reply
Truncated url.db via jump.cgi
Lately there seems to be the problem of the url.db file being truncated with XXX number of entries omitted from the tail.

I discovered this when some people notified me that when they clicked on their listing they were returned to the list site. Upon rebuilding, the problem is resolved as the url.db file is rebuilt.

There are about 3100 links in the database. Anyone else having this problem? I may have to adjust the scripts to omit jump.cgi and go directly to the urls.

Dan Smile


------------------
Quote Reply
Re: Truncated url.db via jump.cgi In reply to
Is your linksid.txt file in sync with the number of links in your database?
Quote Reply
Re: Truncated url.db via jump.cgi In reply to
Yep. There never has been a problem with any of the other data files including the linksid.txt file. I was wondering if this problem can be caused if 2 or more persons access the script (via clicking on a jump.cgi link) at the same time - virtually in the same split second.

If the case, then maybe locking down (using a semaphore type locking routine) the script while it is being accessed may be the answer to prevent multiple simultaneous access.

Dan Smile
Quote Reply
Re: Truncated url.db via jump.cgi In reply to
Due to the fact that this error is occurring repeatedly on a daily basis, I've had to modify the jump.cgi scipt by commenting out the lines writing to the url.db file.

This problem is increasing with increasing traffic and often corresponds to high traffic periods. So it seems that it is a problem with file locking.

The script does use file locking. However, flocking is not the best type of locking - compared to semaphore locking where you create temporary files (filename.ext.lok) that when found, prevent any read/write processes of the file. I discovered this when I was researching file locking for a script that I wrote that also runs similar risks and involves sensitive files.

Alex, what do you think? And please don't get me wrong. It is an excellent script as 'we' all know and I have no complaints but just thinking out loud with regard to this one thing. BTW, this is in regard to Links 1.1

Dan Smile
Quote Reply
Re: Truncated url.db via jump.cgi In reply to
For whatever reason, it worked. The url.db file has been 100% fine since.

Dan Smile
Quote Reply
Re: Truncated url.db via jump.cgi In reply to
Dan,

This is one of the things that Links v2 fixes. Others have reported problems with the url.db file under Links v1 before. Version 2 does things a bit differently, while still using flock, but more reliably.

[This message has been edited by Bobsie (edited July 14, 1999).]
Quote Reply
Re: Truncated url.db via jump.cgi In reply to
Thanks! I was not aware of that. Instead I'll wait until my cash reserves are up more and shoot for Links SQL. My database is at 3200+ links and nearly 700KB so it is getting near the point to upgrade to SQL.

Dan Smile