Anyway to stop programs from locking files?

Status
Not open for further replies.

Karmashock

Posts: 223   +0
I have several files that are often read/written to by different programs on a regular basis. As a result it isn't uncommon for some of the files to be locked.


Is there anyway to allow many different programs to write to a given file at once?


I really don't care how complex the solution is... It just needs to happen.
 
Karmashock said:
I have several files that are often read/written to by different programs on a regular basis. As a result it isn't uncommon for some of the files to be locked.

Is there anyway to allow many different programs to write to a given file at once?

I really don't care how complex the solution is... It just needs to happen.
Not without rewritting the program. Access to files is performed with a call
to OPEN() and it takes the file filename and a mode. The ability to allow multiple
writers requires a mode change and an extra call around each write.

The other solution is a special process that controls the open/write operations
and all other programs send data to it via an IPC call.
 
If the file(s) remains locked for too long, someone has done a lousy job.

As JOBEARD says, the software needs to be modified. Should be easy enough.
 
ravisunny2 said:
If the file(s) remains locked for too long, someone has done a lousy job.
it is common for output files to be held open until the task ends -- thus the
long times. There are huge performance issues for open/write(append)/close on every write
unless the volume of data is trivial and infrequent.

As JOBEARD says, the software needs to be modified. Should be easy enough.
only if (1) you have the source and (2) you know how :)
 
let's move back to the top -- What are you trying to do? What program outputs
are you attempting to merge into one file?
 
jobeard said:
it is common for output files to be held open until the task ends -- thus the
long times. There are huge performance issues for open/write(append)/close on every write
unless the volume of data is trivial and infrequent.

only if (1) you have the source and (2) you know how :)

Are you trying to access a file not meant for you ?

If it's not meant for you, you can expect it to be locked at the most unfortunate of times.

But if the file is meant for multiple access, it shouldn't be locked too long.

Depends on the application.

Also you can find a file locked if someone decides to take a cofee break in the midst of a simple entry !
 
Don't give up so easily

Karmashock said:
Screwed on both points... oh well... I guess I can do it a different way. Thanks anyway. :)

Okay. This is like shooting an arrow in the dark.

Are you trying to access the file through an application software ?

What kind of a file is it ?

If it’s a data file (any kind), you might be able to save yourself a lot of time (at least get something useful done while you’re waiting for the file to get unlocked).

Write an infinite loop that tries to access the file in question. When access is allowed, pass on the control to your favorite slogan/song (God save the Queen, or whatever (be sure to allow loud beeps, tones, songs …)). Then, again depending on the access rights, lock it yourself, or make a copy, for a leisurely look.

For heaven’s sake, don’t mess with a file that is not meant for you !

This way you don’t need to mess with the original source code, and the code you need to write (or get a buddy to write) is nearly elementary
 
tweakboy said:
Not really,,,,,,,, you can with third party software ,,
what are specifically referring to? Allegations without a citation are not very helpful :(

For outputs to stdout or stderr, one can use redirection/append mode but direct
calls to write on a hd or socket handle are not intercepted with trival code.

Let's get off this thread -- the user has long given up anyway.
 
I don't know if this is what you're looking for but having a quick skim of this topic I thought that this may help:
http://ccollomb.free.fr/unlocker/

You can right click a file and choose Unlocker, and it will unlock that file from any processes which are using it. This will then allow you to do what you want with it. More info & screenshots of what I mean on that website.

That may also be the 'third party software' that tweakboy is referring to I don't know.

Edit:
Re-reading your first post again I'm not sure this will actually do what you want, but I'll leave it out there anyway incase it does help. :) Not sure which files you're trying to use or why you would want to be writing to them from two places at once.
 
jobeard said:
let's move back to the top -- What are you trying to do? What program outputs
are you attempting to merge into one file?
it's an old dos version of dBase... it's extremely old... I think my solution will be to upgrade to a newer version... something which we've been afraid to do because we don't know if the new version will work the same way. We've programmed this database continuously for over ten years and the thought of redoing any of it would be death.


basically lots of users access a single database all the time and 95 percent of the time it works fine but every once in a while part of the db is locked by another user that is editing it... you can't even read it...
 
Apologies if it sounds obvious but you could make a backup of the database, then if the newer version of dBase doesn't work how you want it to then restore the old one.

Don't know anything about dBase so that's all I can suggest. Hopefully someone else will understand better.
 
tomrice32 said:
I don't know if this is what you're looking for but having a quick skim of this topic I thought that this may help:
http://ccollomb.free.fr/unlocker/

You can right click a file and choose Unlocker, and it will unlock that file from any processes which are using it. This will then allow you to do what you want with it. More info & screenshots of what I mean on that website.

That may also be the 'third party software' that tweakboy is referring to I don't know.

Edit:
Re-reading your first post again I'm not sure this will actually do what you want, but I'll leave it out there anyway incase it does help. :) Not sure which files you're trying to use or why you would want to be writing to them from two places at once.
that's a great program... I use it sometimes for other things. But it's not what I need.


Ideally I'd need to have some way to have programs think they were locking files when in fact they weren't... but then for all I know that could lead to horrible file corruption. So I think it's hopeless.
 
Karmashock said:
basically lots of users access a single database all the time and 95 percent of the time it works fine but every once in a while part of the db is locked by another user that is editing it... you can't even read it...
you should be thankful! this kind of locking is done to protect the file from multiple writes that would trash the file. If not done like this, your data would be corrupted.
tomrice32 said:
I don't know if this is what you're looking for but having a quick skim of this topic I thought that this may help:
http://ccollomb.free.fr/unlocker/
this is a trival GUI to reset the Read Only attribute and avoid the multiple clicks
down to the property sheet. this is not the same thing as the file locking due to
an active program
 
Status
Not open for further replies.
Back