Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > More file locking problems

Reply
Thread Tools

More file locking problems

 
 
darrel
Guest
Posts: n/a
 
      04-21-2006
I've been dealing with a file locking issue for a while.

Our CMS spits out a new XML file each time an item in the DB is updated.
This XML file is basically our site menu, and is what we use on the front
end to render out site's navigation, site map, breadcrumbs, etc.

We're using it because it's more efficient to just cache the XML file rather
than doing recursive DB calls on each page load.

We ran into a problem where, as far as we can tell, once in a great while,
two people would try to save the same file at the exact same time,
interupting the first file write and leaving only half of an XML file in the
filesystem, which, obviously, is invalid, thereby breaking our site.

So, we started doing file locking. If the file is being written, nothing
else is supposed to write to it. Which isn't a big deal, as the next person
to edit any other page will, in turn, update the XML file when they save.

We thought that fixed things, but now we're back to the same problem + a new
one.

So, my questions:

1) Is there any way to log/test for the incomplete XML file? I'm thinking
that one option is every time any page in the system (be it on the admin
side or public side) needs to to access the XML file, and it's invalid, that
it callse the function to rewrite it and then tries to execute again. Alas,
that seems REALLY hacky and open to all sorts of nasty logic loops.

Any other ideas?

2) Another issue is that one of the XML files that was half-written is also
now locked by another process, so I can't even write a new file if I want to
until I reboot asp.net on the server. Any way to see what is currently
locking a file?

I hope others are having a more enjoyable Friday afternoon ;o)

-Darrel


 
Reply With Quote
 
 
 
 
darrel
Guest
Posts: n/a
 
      04-21-2006
I have a hunch that rtvscan might be the culprit (norton).

Anyone have any experience with that? I assume it may be scanning files that
are being created and then locking them.

-Darrel


 
Reply With Quote
 
 
 
 
Jeff Dillon
Guest
Posts: n/a
 
      04-21-2006
Why don't you write the XML back to the database, instead of the file
system. SQL supports an XML datatype, or just save it as text

Jeff
"darrel" <(E-Mail Removed)> wrote in message
news:e8$(E-Mail Removed)...
> I've been dealing with a file locking issue for a while.
>
> Our CMS spits out a new XML file each time an item in the DB is updated.
> This XML file is basically our site menu, and is what we use on the front
> end to render out site's navigation, site map, breadcrumbs, etc.
>
> We're using it because it's more efficient to just cache the XML file
> rather than doing recursive DB calls on each page load.
>
> We ran into a problem where, as far as we can tell, once in a great while,
> two people would try to save the same file at the exact same time,
> interupting the first file write and leaving only half of an XML file in
> the filesystem, which, obviously, is invalid, thereby breaking our site.
>
> So, we started doing file locking. If the file is being written, nothing
> else is supposed to write to it. Which isn't a big deal, as the next
> person to edit any other page will, in turn, update the XML file when they
> save.
>
> We thought that fixed things, but now we're back to the same problem + a
> new one.
>
> So, my questions:
>
> 1) Is there any way to log/test for the incomplete XML file? I'm thinking
> that one option is every time any page in the system (be it on the admin
> side or public side) needs to to access the XML file, and it's invalid,
> that it callse the function to rewrite it and then tries to execute again.
> Alas, that seems REALLY hacky and open to all sorts of nasty logic loops.
>
> Any other ideas?
>
> 2) Another issue is that one of the XML files that was half-written is
> also now locked by another process, so I can't even write a new file if I
> want to until I reboot asp.net on the server. Any way to see what is
> currently locking a file?
>
> I hope others are having a more enjoyable Friday afternoon ;o)
>
> -Darrel
>
>



 
Reply With Quote
 
darrel
Guest
Posts: n/a
 
      04-21-2006
Well, killing asp.net and forcing it to restart released the file, so I
suppose it's an issue with my application. I'm obviously missing a proper
FINALLY statement in a try/catch somewhere...

-Darrel


 
Reply With Quote
 
darrel
Guest
Posts: n/a
 
      04-21-2006
> Why don't you write the XML back to the database, instead of the file
> system. SQL supports an XML datatype, or just save it as text


Hmm...ya know, that might be the best way to go about this.

The reason we were using the XML file was that it was easily cached by the
system. I can easily check to see if the file has been updated, and, if not,
just use the cache.

I assume with the DB solution, I'd have to always query the DB on each page
load to see if it's a new file (or is that assumption wrong)?

-Darrel


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Locking locking resolution Frontpage raiderhawk General Computer Support 0 01-08-2008 01:42 AM
increase in cpu usage on locking and locking the system sowmya.rangineni@gmail.com Computer Support 0 06-15-2007 12:06 PM
Application locking to support optimisitc locking ? Timasmith Java 4 11-01-2006 12:42 AM
More than pessimistic record locking needed... master ASP .Net 9 06-29-2006 11:11 AM
Confused about locking a file via file.flock(File::LOCK_EX) Ludwigi Beethoven Ruby 5 07-26-2003 03:26 PM



Advertisments