COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Identifying who owns a write-locked file

• Email
• Follow

When a document is opened for read/write by OpenOffice 2.0 on Solaris
8, that document file gets write locked, so that no one else can update
it. (Which is a good thing.)

What sometimes happens though is that a document is opened (and
therefore locked) by a mysterious someone, and the rest of us on this
fairly good-sized project can't figure out who has the document open in
order to get them to release it.

Open or closed, the file's permissions are 664, and so we're trying to
find out who's got the lock on the file. I've been all over the web and
newsgroups, but haven't come up with anything yet.

Any suggestions would be appreciated--thanks.

Marc A. Criley
Cohesion Force, Inc.


 0

See related articles to this posting

In article <1165331144.851036.38820@73g2000cwn.googlegroups.com>,
"mcriley" <marc.a.criley@lmco.com> wrote:

> When a document is opened for read/write by OpenOffice 2.0 on Solaris
> 8, that document file gets write locked, so that no one else can update
> it. (Which is a good thing.)
>
> What sometimes happens though is that a document is opened (and
> therefore locked) by a mysterious someone, and the rest of us on this
> fairly good-sized project can't figure out who has the document open in
> order to get them to release it.
>
> Open or closed, the file's permissions are 664, and so we're trying to
> find out who's got the lock on the file. I've been all over the web and
> newsgroups, but haven't come up with anything yet.
>
> Any suggestions would be appreciated--thanks.
>
> Marc A. Criley
> Cohesion Force, Inc.

It must be a running process.  Have you tried lsof (not installed by
vanilla Solaris)?

Or if you don't have access to lsof (requires root), locking is a
function of the application rather than the OS.  Your best bet might be
to download OpenOffice and puruse the source code.  Maybe it can show
what, if any, tracks this.

--
DeeDee, don't press that button!  DeeDee!  NO!  Dee...


 0

mcriley <marc.a.criley@lmco.com> wrote:
> What sometimes happens though is that a document is opened (and
> therefore locked) by a mysterious someone, and the rest of us on this
> fairly good-sized project can't figure out who has the document open in
> order to get them to release it.

Depends on exactly the locking mechanism used.

If it's using OS locking, run 'fuser' on the file.  It'll show the PID
of any processes that have the file open and/or locked.  Hopefully you
can then track down the owner of that PID.

--
Darren Dunham                                           ddunham@taos.com
Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
< This line left intentionally blank to confuse you. >

 0

mcriley wrote:

> When a document is opened for read/write by OpenOffice 2.0 on Solaris
> 8, that document file gets write locked, so that no one else can update
> it. (Which is a good thing.)
>
> What sometimes happens though is that a document is opened (and
> therefore locked) by a mysterious someone, and the rest of us on this
> fairly good-sized project can't figure out who has the document open in
> order to get them to release it.
>
> Open or closed, the file's permissions are 664, and so we're trying to
> find out who's got the lock on the file. I've been all over the web and
> newsgroups, but haven't come up with anything yet.
>
> Any suggestions would be appreciated--thanks.
>
> Marc A. Criley
> Cohesion Force, Inc.
>

man fuser

 0

Richard B. Gilbert wrote:

> man fuser

fuser doesn't work for this because we've got over a hundred
workstations on the project and the file resides on a shared volume.

I'm hesitant to try to get any new software (such as lsof) on the
system because there's such a significant bureaucratic chain to go
through.

Marc


 0

mcriley wrote:

> Richard B. Gilbert wrote:
>
>
>>man fuser
>
>
> fuser doesn't work for this because we've got over a hundred
> workstations on the project and the file resides on a shared volume.
>
> I'm hesitant to try to get any new software (such as lsof) on the
> system because there's such a significant bureaucratic chain to go
> through.
>
> Marc
>

If you give access to the file to over one hundred users, such problems
seem a natural consequence!  It would seem that you have no choice but
to obtain and install a tool such as lsof.  And when you find the
asshole who has the file locked, perhaps you can have him killed!


 0

In article <M5ydnUj7ZYNfJOjYnZ2dnUVZ_oGdnZ2d@comcast.com>,
"Richard B. Gilbert" <rgilbert88@comcast.net> wrote:

> mcriley wrote:
>
> > Richard B. Gilbert wrote:
> >
> >
> >>man fuser
> >
> >
> > fuser doesn't work for this because we've got over a hundred
> > workstations on the project and the file resides on a shared volume.
> >
> > I'm hesitant to try to get any new software (such as lsof) on the
> > system because there's such a significant bureaucratic chain to go
> > through.
> >
> > Marc
> >
>
> If you give access to the file to over one hundred users, such problems
> seem a natural consequence!  It would seem that you have no choice but
> to obtain and install a tool such as lsof.  And when you find the
> asshole who has the file locked, perhaps you can have him killed!

And install a code management system while you're at it.  This senario
just screams CVS (or whatever).  What's the lost to productivity this
has caused so far?

Is it worth (a) installing tools to solve the problem or (b) standing
behind a bureaucratic chain and saying "it's production" with how many
people sitting on their hands because they can't do their work because
of one twit?

If the answer is (b), you've got bigger problems.  Lots of organizations
get into this pickle.  There are lots of solutions to it as well.
You'll have to find the one that works for you.  Hint: if it involves
firearms, that can be career limiting.

--
DeeDee, don't press that button!  DeeDee!  NO!  Dee...


 0

mcriley <marc.a.criley@lmco.com> wrote:

> Richard B. Gilbert wrote:

>> man fuser

> fuser doesn't work for this because we've got over a hundred
> workstations on the project and the file resides on a shared volume.

Ah, I didn't understand that this was shared out via NFS.

> I'm hesitant to try to get any new software (such as lsof) on the
> system because there's such a significant bureaucratic chain to go
> through.

I don't believe lsof will help anyway.  Just like fuser, you'd have to
run it on the individual workstation.  Even if it could tell you
anything, all it would be able to say is that lockd had a lock on it.

It would be nice if you could query the NFS lock daemon to dump status,
but I don't know any way to do so.

--
Darren Dunham                                           ddunham@taos.com
Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
< This line left intentionally blank to confuse you. >

 0

Michael Vilain  wrote:

> And install a code management system while you're at it.  This senario
> just screams CVS (or whatever).

Hum, for a binary file like an openoffice file, cvs is just an other
locking mechanism, and not a very good one. I believe office has some
features to merge modifications done by several users (at least microsoft
communicated on the fact that its version had domething like that), you
might want to look into that.

 0

ls -l

Barry
=====
http://members.iinet.net.au/~barry.og

 0

In article <e4gkn25h2v2glb6c4uiokf1msesl525bon@4ax.com>,

> ls -l
>
> Barry
> =====
> http://members.iinet.net.au/~barry.og

I'm just hypothesizing here.  If NFS mounted copy of OpenOffice is being
used to access a NFS document that has wide access and reports that the
document is "locked", something is tracking that.  If the file doesn't
have a lock status (shown by ls -l) then it's internal to OpenOffice and
good luck wandering around the source trying to figure that out.  Even
in a distributed environment as you mentioned, I don't see a way to
figure this out other than to get a ClueByFour(tm) from the lumbar yard
and apply it librally about the neck and shoulders of the culprit.

Then FIX THIS PROCESS.  IT TOTALLY BROKEN.  You mentioned you can't
install "extra tools" like lsof (which is free) or a binary-compatible
CVS (e.g. IBM's Documentum--not free and requires a fullsized server but
allows tracking for engineering documents, PDFs, Word, anything really).

If you're just a worker drone complaining about the problem, thanks for
sharing.  If you want to propose a solution that will save your company
time, money, and productivity.  The current cooperative solution isn't
working.  So fix it.

--
DeeDee, don't press that button!  DeeDee!  NO!  Dee...


 0

10 Replies
806 Views

Similar Articles

12/12/2013 2:52:39 AM
page loaded in 51446 ms. (0)

Similar Artilces:

file locked for writing
Hello! I use some script in python 2.5 from vim editor (it has python bindings) that updates some file and then launches another program (ms visual studio, for example) to do something with updated file. I faced problem when updated file is locked for writing until vim editor is closed. launch vim -> update file -> launch msvc -> file locked launch vim -> update file -> launch msvc -> close vim -> file locked launch vim -> update file -> -> close vim -> launch msvc -> file okay Update code is something like that: backup_file_name = '<some file nam...

Unable to lock a file to stop sendmail writing to it
Hi all, I am trying to write a script that reads a mailbox that sendmail updates, but I want to be able to lock the file, read the file, empty the file and unlock the file again. The problem I have is that locking doesn't seem to work. As I can't lock the file, sendmail writes into the file while i'm writing and that causes all sorts of problems. Here are some things I tried:- sysopen(FH,"/tmp/file",O_EXCL | O_RDWR) || die "Error:\$!"; print "File opened\n"; sleep 20; close FH; or use Fcntl ':flock'; # import LOCK_* constants open(FILE,&q...

How should I model the following design problem : 1) I need to read/write a set of bytes from/to the binary file between a starting address and ending address. 2) Before writing the bytes I should pass file name with extension so that the bytes will be written in that file. 3) I need to reduce the number of I/O operation while reading/writing the bytes so that I could improve the performance. 4) How would I specify the error handling strategy? 5) What kind of design pattern I could employ to achieve the above requirements. If possible please point me to industrial strength c++ implementation...

Hi, I am trying to see on which situations does the Read-Write Lock performs better on primitive Lock() itself. Below is the code I am using to test the performance: import threading import locks import time class mylock(object): def __init__(self): self.__notreading = threading.Event() self.__notwriting = threading.Event() self.__notreading.set() self.__notwriting.set() def acquire_read(self): self.__notreading.clear() self.__notwriting.wait() def acquire_write(self): self.__notreading.wait() self.__notwriting.clea...

Memory leak writing NetCDF4 files but not NetCDF3 files
One of my scripts used to write many large NetCDF3 files (80-200 MB each). For storage reasons, I changed this script to write to NetCDF4 files with compression: Old: ncid=netcdf.create([outputfolder fname_nc], 'CLOBBER'); New: ncid=netcdf.create([outputfolder fname_nc], 'NETCDF4'); Unfortunately, after the new script runs, MATLAB doesn't free the memory used during the time the script runs. For example: NetCDF3 - Before function runs: memory; gui_1('RAXPOL-20130417-225616.dat'); memory Maximum possible array: 11806 MB (1.238e+010 bytes) * Mem...

log file sync , log file parallel write
Hi , my top wait list shows 2 events , log file sync and log file parallel write in 1 hour. During this time , the db server created 370,594 bytes redo per second. the docs say that high value of both log file sync and log file parallel write indicates io problem . How can we decide whether below numbers are close to each other or not? If it is not possible to change the application and eliminate the unnecessary commits (such as sap) , how can lg file sync be decreased? Kind Regards Load Profile ~~~~~~~~~~~~ Per Second Per Transaction ...

writing to files
I have been encoutering this problem of writing to files . I generally use the standard format of write((char *)&(<object>),sizeof(<object>); but while retrieving it is always creating a problem and I am not able to retrieve the data. Kindly tell me what is the better way to store the data into files? [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] tvsivakumar@gmail.com <tvsivakumar@gmail.com> wrote: > I have been encoutering this problem of writing to files . I > generall...

File Locking
(Hope this is not considered off-topic) I wish to perform a seemingly simple task, but all the FAQ reading and example browsing don't seem to offer a solution. I wish to create mutual exclusion on a resource I have which several processes might want to change, let's assume for now that all are on the same machine. I do *not* wish to leave my lock files hanging around the file-system any longer than necessary (I have hundreds of thousands, if not more, such resouces). The "text book" solution might be: 1) fd = open( "my.lock", O_RDONLY | O_CREAT ); 2) flock( fd, ...

Program for retrieving certain lines in a file and writing them to another file
Hi all, I am trying to write a program that scans a large log file and only extracts the lines that pertain to an error message and writes it to a different line. Basically the log file will be of this format : Junk Junk ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Error.............................................\n Junk Junk Junk~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Error..............\n So between the junk text there will be these long Error strings that are terminated by a new line. Now I know how to open the actual file and also looked up ...

Writing files
Hello When I call fclose() on a file I've been writing to, does fclose always write the EOF character before closing the file? Or do I need to write the EOF myself? Another question: If I've got a file opened in update (r+) mode, how can I delete a character in the file? I want to do this without needing to create a second file and copy all but the characters I want to delete. Is there some kind of control sequence that will do this? Any help greatly appreciated. Edward Rutherford <edward.p.rutherford79@REMOVETHIS.gmail.com> writes: > When I call fclose()...

Write to file
I need to change a txt file but when i use the fortran Write command to change it, the rest of the file content is erased. I can i change a txt file without erasing the rest of the file? Tanks... Carvalho <jfscarvalho@gmail.com> wrote: > I need to change a txt file but when i use the fortran Write command > to change it, the rest of the file content is erased. I can i change > a txt file without erasing the rest of the file? Basically, no. That's the way sequential files work. In that statement does lie one hint. You can do things like that with a direct access file. ...

How to Lock a file
Hi all, I am new to Unix programming. I have to create a file somewhere (on /tmp) and get a lock on it. It can simply be a zero length file, the important thing is that it's locked. When the program starts up, have it try to get a lock on the file. If it can't get a lock,then I will simply exit. Please some body explain how to do it using C programming Thanks, Seema Rao On 3 Nov 2005 05:55:26 -0800, seema wrote: > Hi all, > > I am new to Unix programming. I have to create a file somewhere (on > /tmp) > and get a lock on it. It can simply be a zero length file, t...

files on server cannot be moved, deleted, written (file locking problem)
From what I gather from discussions elsewhere on the internet, the following is an old problem, but still not solved. We run a shop with mostly Macs, and a Windows file server. Users write their files to the server via SMB. Sometimes (but not always), users can no longer perform write operations on a file: they can no longer write to, copy or move certain files. Looking at the file server revealed that the resource forks of old files (which are saved as separate files by OS X) sometimes remain 'locked', even though the data fork has been released long since. Locking is where the se...

Writing in a file
Good morning, I would like to create a command that would write in a file the given arguments: \newcommand{\proofannexe}[1]{ \newwrite\preuveann \openout \preuveann =preuves \write \preuveann{\noexpand #1} \closeout \preuveann } When I replace #1 with, for instance, \textbf{test}, it works perfectly, but else I always have errors ! How should I do ? Thank you :) If you are trying to write the string \text{test} into a file (as in write the "\" and the "{" exactly as shown), then try the following. Note that I added some "%" at the end of the line to avoid pu...

locked file
i have a code that backsup file from src to dest. Now if some of the files are locked , i need to skip those files.. I was trying to use fctl module but it can be used only in unix i suppose. is there anyother way? i am using windows os. Kirt wrote: > i have a code that backsup file from src to dest. > Now if some of the files are locked , i need to skip those files.. > I was trying to use fctl module but it can be used only in unix i > suppose. > > is there anyother way? i am using windows os. What does locked mean in this case? No read permissions? In use by another...

Mex-file unable to be identified by MCC generated Exe file
Hi, I am using mex to comiple a C module (EXTRACTF.c) and it is working fine when I call it from my matlab program under matlab environment. However, when I use MCC to compile this Matlab program to an exe file, if I run this exe file, I always receive below message: Invalid MEX-file 'C:\test\toolbox\mexw32\EXTRACTF.mexw32':The specified module could not be found. I check the folder and the MEX file do exist there. I am no idea why such case happened and do not know how to solve it. Appreciate it if anyone can help. Thanks. Wang ...

Write to file
Hello, I'm trying to output buffer content to a file. I either get an access violation error, or crazy looking output in the file depending on which method I use to write the file. Can anyone help out a newbie? #include <stdio.h> #include <ctype.h> #include <string.h> #define DISPLAY 117 /* Length of display line */ #define PAGE_LENGTH 20 /* Lines per page */ int main(int argc, char *argv[]) { FILE *pfile; FILE *outfile; char *p; unsigned char buffer[DISPLAY/4 - 1]; /* File input buffer */ int count = 0; /* Count of chara...

File Lock
What is the simplest (best?) way to create a file lock? I have a few machines trying to access a common file that contains work to do (computer farm). Each computer needs exclusive access to this network file to see what work is available. Currently, each machine trys to rename the file, modifies it, and then renames it back to the original. This works maybe 99% of the time, but sometimes 2 machines seem to get their own copy of the work file and I get 2 versions of the work file floating around. The machines are running Windows XP and 2000, and have a common network share. Try the foll...

How to write multiple files (.dat or .txt) with consecutive file names in matlab
I have the following scenario: for t = 1:10 % As time goes from 1 to 10. for i = 1:10 % As position goes from 1 to 10. u(i) = some operation end s = u'; % Just getting a transpose so i can read the data better. save ("File(i).txt', 's', '-ascii', '-tabs'); % I know this doesn't work. I need a help with this. end Desired output: File1 : with dat...

Using write function within email Module to write get_payload to a file.
fp = file("/home/chuck/pythonScript/testbox") mbox = mailbox.UnixMailbox(fp, email.message_from_file) # list of body messages. bodies = [] # mail is the file object for mail in mbox: print mail['Subject'] print mail.get_content_type()#text/plain print mail.get_payload() fp = file("/home/chuck/pythonScript/testbox") mb = mailbox.UnixMailbox(fp, email.message_from_file) mailout = file("/home/chuck/pythonScript/SurveyResults.txt","w") #for mail in fp.readlines(): # mailout.write(mail) ## Somethi...