Lost and Corrupted LinkClick links in DNN modules

Blog 2
Location: BlogsAll BlogsDNN Tips    
Posted by: mamlin 2/13/2008 7:04 PM

The Problem: Reassigned File IDs
Some time ago our web team encountered an annoying and potentially devestating issue on one of our production DotNetNuke servers.  It seemed that, overnight, hundreds of DNN file links became corrupted.  The result was that many document links in our Documents modules no longer linked to the target files but instead linked to...nothing.  The target files were still present on the server but the DNN file ID values were now different.  Affected files had been reassigned new DNN file IDs as if the files were brand new to the DNN instance.  We checked logs in DNN, IIS and on our servers but found no clue as to what caused the file IDs to change.  Stranger still, only a few hundred of the thousands of file IDs had been affected.

We did not want to revert to the previous day's backup copy of the database since we would lose any new data introduced since the backup.  Instead, we repaired the broken file links by updating all old file ID references with the new file IDs (we created some custom database scripts for this).  After our file IDs were back in order, we spent a bit more time snooping around our systems and checking our favorite DNN forums but found no answers to our file ID issue.

Over the next couple of weeks the same issue occured several more times.  The issue would occur both at night and during the daytime working hours but never on an identifiable schedule.  Sometimes only a few dozen IDs would be affected.  Once several thousand (!) were affected.  Each time we were able to use our custom scripts to repair the damage but were still no closer to discovering the cause.

The Cause
One of our developers eventually noticed a time correlation between a scheduled task on another server and our instances of reassigned file ID.  We learned that our operations department had scheduled a file backup process to run twice a day -- once at night and once during the day. 

DNN "Auto-Sync" Feature
Our file backup process locked entire directories of files while performing backups.  Normally this should not be an issue but DNN has a HOST feature called "Auto-Sync File System".  (In DNN 4.3.x it is the very last HOST option under "Other Settings".)  The "Auto-Sync" feature runs on a timer and causes DNN to re-index all files under the PORTALS directory.  This is useful in environments where files may be directly added under PORTALS (using Windows Explorer or FTP, for example) rather than through the DNN user interface.  Using the DNN interface, files are assigned file IDs automatically.  When NOT using the DNN interface, files will not appear to certain modules (such as Documents) until a file sychronization has been performed (file IDs have been assigned).  The Auto-Sync feature takes care of such situations without any action from the user.

When "Auto-Sync" did its thing, AND when our file backup process happened to be backing up anything under the PORTALS directory at the same time, DNN would be unable to see the "locked" directories and would assume that those files were deleted.  DNN would then dutifully remove those file entries (and assoicated file IDs) from the DNN database. 

That explains why the old file IDs dissapeared, but where did the new IDs come from?  Well, the next time Auto-Sync ran (every hour in our case) the formerly "locked" directories would now be unlocked as our file backup process had moved on from those directories.  DNN would now see those as "newly added" files and would assign new file IDs.

The Fix
Our solution was simple -- since we did not want to give up or otherwise modify our file backup solution we instead turned off the DNN "Auto-Sync" feature. 

Note that by turning this off we were then required to use the DNN "File Manager" (available to both Admin and Host) to perform a "synchronize files" operation (in order to assign DNN file IDs) anytime we manually moved files to any directory under the PORTALS directory. 

NOTE:  If you'd like to turn off "Auto-Sync" but have non-ADMIN users who need to manage files, check out our blog posting HERE about exposing the FILE MANAGER admin module to non-ADMIN users.

 

Permalink |  Trackback

Comments (5)   Add Comment
Re: Lost and Corrupted LinkClick links in DNN modules
Sebastian Leupold    4/10/2009 12:35 PM
Please note, that Auto-Sync is not called by a timer, it is executed for all files inside a single folder, whenever its content is listed inside the URL control (or another similar situation). Please do not mix up with Scheduler Job "Sync Files" which had a problem and was removed in DNN 4.9.2 ff.

Re: Lost and Corrupted LinkClick links in DNN modules
mamlin    4/10/2009 12:41 PM
Thanks for that clarification, Sebastian. I'll update/rewrite this posting to reflect the distinction and the fact the scheduled file sync process has been removed from current versions.

Re: Lost and Corrupted LinkClick links in DNN modules
Xavier Hernandez    8/20/2009 1:26 AM
HI, I have the same problem and I wonder if you could post the script used to recover the right FileID "by updating all old file ID references with the new file IDs". Thanks.

Re: Lost and Corrupted LinkClick links in DNN modules
mamlin    8/20/2009 1:31 AM
Xavier- It was actually a series of scripts for updating multiple tables rather than just a single magic script. Also, our scripts made some assumptions about our files and file structure that may not apply to everyone. It's been a while but I'll dig up what we used and see about posting a basic example in the next day or two.

Re: Lost and Corrupted LinkClick links in DNN modules
mtoerner    10/16/2009 1:56 PM
Wow! This has happened to us several times and it did cause me to want to pull my hair out.. Thanks for the info!


Your name:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel 
You are here:  
 
>> Back to the top of the blog list...

 
        account   blog   click   cloud   code   create   data   events   example   feature   file   files   free   function   good   google   just   line   links   list   module   modules   need   note   number   option   page   pages   query   results   role   roles   script   search   select   settings   simple   site   skin   solution   step   tags   terms   time   user   users   value   version   want  
Minimize Google AJAX Search
 
Search ES:  
This is an example of a Google AJAX Search with asynchronous search execution for two searches.  See our blog series, 'Add Google AJAX Search to your DNN skin' for info and sample code.
 
     
Minimize Buy Stuff
 
Stuff by Eguana Solutions
(Be sorta cool!)
 
     
Minimize Most-Commented Blogs
 
 
     

Minimize Looking for more info?
 

There are tons of helpful
posts from Eguana Solutions 
on the DotNetNuke.com forums.
  
 
Click HERE to see our posts.

 
     
Minimize Modules for Sale
 

Looking for Eguana's modules? 
We're still working on them!
  

Until ours are ready to dazzle and
amaze, you'll have to make do with
the thousands of modules already
available on SnowCovered.

 
     
Minimize Favorite Modules
 

There are many great DNN modules.
A few we highly recommend are:
 
Dynamic Registration
Total control over the user signup process.  Create custom forms, execute your own SQL, use the integrated payment processing features to assign user roles, validate USERNAMEs via AJAX and much more.  Very cool.
 
URL Master
Change to friendly URLs that really ARE friendly.  Add keywords into your page URLs for better SEO.  Create 301 redirects for individual pages.  Force visitors (and search bots) to a single domain (i.e., make everyone use the "www" version of your site's URL or vice versa).  One of the single best upgrades for any DNN site.
 
Document Exchange 5 (DMX5)
Drag-and-drop from Windows Explorer directly into the DMX file manager!  File versioning, file and folder moderation, extend user permissions down to the file level (for user groups and even for individual users).  Infinite file and file info presentation options via custom display templates.  Store files locally or remotely via UNC (i.e., can securely store files somewhere besides your web server).  Much more.
 
XMOD by DNNDev
Rock-solid form module for data collection.  From simple feedback / email forms to complex, multi-part tabbed forms.  XMOD is different from other form modules because XMOD does not create a new database table for every new form definition -- an important feature if you plan to create dozens or hundreds of forms over the life of your DNN instance!  Excellent support from the developer and an active community around this module.
 
If you desire your form module to create a new DB table for each new form definition, a great alternative to XMOD is the Dynamic Forms module from DataSprings.  Dynamic Forms offers direct DB access beyond that found in XMOD as well as an easy drag-and-drop form builder option to help you get up and running very quickly.

 
     

Login