Re: How do I unlock?
: 1) The FAQ has been moved to the Wiki, so feel free to stick it in : there. yeah ... i just wanted to give people a chance to chime in with weird ways locks are used in case i wasn't aware of something. : 2) http://www.lucenebook.com/search?query=unlock ah ... yes. The really pitiful thing is, I remember looking at that method before. FAQed... http://wiki.apache.org/jakarta-lucene/LuceneFAQ#head-59be30838bbb5692e605384b5f4c2f224f3dfa6f : > 1) There should probably be a FAQ on discussing: : > 1) where lock files are typically found on various OSes : > 2) the naming convention of lucene lock files. : > 2) how to manually clean up lock files (and other files in the : > index : >directory) in a safe manner. : > : > 2) it might be a good idea to add a static utility method for cleanly : > removing all locks (or all lokcs of a particular type) on an index : > given a : > Directory. Javadocs would indicate this is an "Expert" method which : > should only be used in code designed to try and recover from serious : > errors. -Hoss - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I unlock?
: What about a shutdown hook? Interesting idea, at the moment the file is created on disk, the FSDirectory could add a shutdown hook that checked for the existence of the file and if it's still there (implying that the Lock owner failed without releasing the lock) it can forcably remove it. Of course: this assumes that LockFiles are never shared between processes -- ie: if client A is waiting on a lock that client B is holding, does the lock A eventually gets use the same file that B's lock was using, or does the old lock file get deleted and a new one created ? (I don't really understand a lot of Lucene's locking code) -Hoss - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I unlock?
Eh, that exactly :) When I read my emails in reverse order --- Chris Lamprecht <[EMAIL PROTECTED]> wrote: > What about a shutdown hook? > > Runtime.getRuntime().addShutdownHook(new Thread() { > public void run() { /* whatever */ } > }); > > see also > http://www.onjava.com/pub/a/onjava/2003/03/26/shutdownhook.html > > > On Tue, 11 Jan 2005 13:21:42 -0800, Doug Cutting <[EMAIL PROTECTED]> > wrote: > > Joseph Ottinger wrote: > > > As one for whom the question's come up recently, I'd say that > locks need > > > to be terminated gracefully, instead. I've noticed a number of > cases where > > > the locks get abandoned in exceptional conditions, which is > almost exactly > > > what you don't want. > > > > The problem is that this is hard to do from Java. A typical > approach is > > to put the process id in the lock file, then, if that process is > dead, > > ignore the lock file. But Java does not let one know process ids. > Java > > 1.4 provides a LockFile mechanism which should mostly solve this, > but > > Lucene 1.4.3 does not yet require Java 1.4 and hence cannot use > that > > feature. Lucene 2.0 is likely to require Java 1.4 and should be > able to > > do a better job of automatically unlocking indexes when processes > die. > > > > Doug > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I unlock?
I didn't pay full attention to this thread, but it sounds like somebody may be interested in RuntimeShutdownHook (or some similar name) as a place to try to release the locks. Otis --- Joseph Ottinger <[EMAIL PROTECTED]> wrote: > On Tue, 11 Jan 2005, Doug Cutting wrote: > > > Joseph Ottinger wrote: > > > As one for whom the question's come up recently, I'd say that > locks need > > > to be terminated gracefully, instead. I've noticed a number of > cases where > > > the locks get abandoned in exceptional conditions, which is > almost exactly > > > what you don't want. > > > > The problem is that this is hard to do from Java. A typical > approach is > > to put the process id in the lock file, then, if that process is > dead, > > ignore the lock file. But Java does not let one know process ids. > Java > > 1.4 provides a LockFile mechanism which should mostly solve this, > but > > Lucene 1.4.3 does not yet require Java 1.4 and hence cannot use > that > > feature. Lucene 2.0 is likely to require Java 1.4 and should be > able to > > do a better job of automatically unlocking indexes when processes > die. > > Agreed - but while there are some situations in which releasing locks > is > "difficult" (i.e., JVM catastrophic shutdown), there are others in > which > attempts could be made via finally blocks, etc. > > --- > Joseph B. Ottinger > http://enigmastation.com > IT Consultant > [EMAIL PROTECTED] > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I unlock?
What about a shutdown hook? Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { /* whatever */ } }); see also http://www.onjava.com/pub/a/onjava/2003/03/26/shutdownhook.html On Tue, 11 Jan 2005 13:21:42 -0800, Doug Cutting <[EMAIL PROTECTED]> wrote: > Joseph Ottinger wrote: > > As one for whom the question's come up recently, I'd say that locks need > > to be terminated gracefully, instead. I've noticed a number of cases where > > the locks get abandoned in exceptional conditions, which is almost exactly > > what you don't want. > > The problem is that this is hard to do from Java. A typical approach is > to put the process id in the lock file, then, if that process is dead, > ignore the lock file. But Java does not let one know process ids. Java > 1.4 provides a LockFile mechanism which should mostly solve this, but > Lucene 1.4.3 does not yet require Java 1.4 and hence cannot use that > feature. Lucene 2.0 is likely to require Java 1.4 and should be able to > do a better job of automatically unlocking indexes when processes die. > > Doug > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I unlock?
On Tue, 11 Jan 2005, Doug Cutting wrote: > Joseph Ottinger wrote: > > As one for whom the question's come up recently, I'd say that locks need > > to be terminated gracefully, instead. I've noticed a number of cases where > > the locks get abandoned in exceptional conditions, which is almost exactly > > what you don't want. > > The problem is that this is hard to do from Java. A typical approach is > to put the process id in the lock file, then, if that process is dead, > ignore the lock file. But Java does not let one know process ids. Java > 1.4 provides a LockFile mechanism which should mostly solve this, but > Lucene 1.4.3 does not yet require Java 1.4 and hence cannot use that > feature. Lucene 2.0 is likely to require Java 1.4 and should be able to > do a better job of automatically unlocking indexes when processes die. Agreed - but while there are some situations in which releasing locks is "difficult" (i.e., JVM catastrophic shutdown), there are others in which attempts could be made via finally blocks, etc. --- Joseph B. Ottinger http://enigmastation.com IT Consultant[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I unlock?
Joseph Ottinger wrote: As one for whom the question's come up recently, I'd say that locks need to be terminated gracefully, instead. I've noticed a number of cases where the locks get abandoned in exceptional conditions, which is almost exactly what you don't want. The problem is that this is hard to do from Java. A typical approach is to put the process id in the lock file, then, if that process is dead, ignore the lock file. But Java does not let one know process ids. Java 1.4 provides a LockFile mechanism which should mostly solve this, but Lucene 1.4.3 does not yet require Java 1.4 and hence cannot use that feature. Lucene 2.0 is likely to require Java 1.4 and should be able to do a better job of automatically unlocking indexes when processes die. Doug - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I unlock?
On Tue, 11 Jan 2005, Chris Hostetter wrote: > 2) it might be a good idea to add a static utility method for cleanly > removing all locks (or all lokcs of a particular type) on an index given a > Directory. Javadocs would indicate this is an "Expert" method which > should only be used in code designed to try and recover from serious > errors. As one for whom the question's come up recently, I'd say that locks need to be terminated gracefully, instead. I've noticed a number of cases where the locks get abandoned in exceptional conditions, which is almost exactly what you don't want. --- Joseph B. Ottinger http://enigmastation.com IT Consultant[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I unlock?
Hello, 1) The FAQ has been moved to the Wiki, so feel free to stick it in there. 2) http://www.lucenebook.com/search?query=unlock Otis --- Chris Hostetter <[EMAIL PROTECTED]> wrote: > > : I'm getting > : Lock obtain timed out. > : > : I was developing and forgot to close the writer. How do I recover? > I > : killed the program, put the close in, but it won't let me open > again. > > if you are using FSDirectory then a lock file was put onto your disk > in > the directory returned by... > > > System.getProperty("org.apache.lucene.lockdir",System.getProperty("java.io.tmpdir")); > > so if you haven't defined the property "org.apache.lucene.lockdir" > then > it's whereever your JVM normally puts tmp files (on *nix it's usually > in > /var/tmp ... somtimes /tmp) > > > This question has come up a couple of times in the last few weeks, > while > leads me to think: > > 1) There should probably be a FAQ on discussing: > 1) where lock files are typically found on various OSes > 2) the naming convention of lucene lock files. > 2) how to manually clean up lock files (and other files in the > index >directory) in a safe manner. > > 2) it might be a good idea to add a static utility method for cleanly > removing all locks (or all lokcs of a particular type) on an index > given a > Directory. Javadocs would indicate this is an "Expert" method which > should only be used in code designed to try and recover from serious > errors. > > > > thoughts? > > > > -Hoss > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I unlock?
: I'm getting : Lock obtain timed out. : : I was developing and forgot to close the writer. How do I recover? I : killed the program, put the close in, but it won't let me open again. if you are using FSDirectory then a lock file was put onto your disk in the directory returned by... System.getProperty("org.apache.lucene.lockdir",System.getProperty("java.io.tmpdir")); so if you haven't defined the property "org.apache.lucene.lockdir" then it's whereever your JVM normally puts tmp files (on *nix it's usually in /var/tmp ... somtimes /tmp) This question has come up a couple of times in the last few weeks, while leads me to think: 1) There should probably be a FAQ on discussing: 1) where lock files are typically found on various OSes 2) the naming convention of lucene lock files. 2) how to manually clean up lock files (and other files in the index directory) in a safe manner. 2) it might be a good idea to add a static utility method for cleanly removing all locks (or all lokcs of a particular type) on an index given a Directory. Javadocs would indicate this is an "Expert" method which should only be used in code designed to try and recover from serious errors. thoughts? -Hoss - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How do I unlock?
I'm getting Lock obtain timed out. I was developing and forgot to close the writer. How do I recover? I killed the program, put the close in, but it won't let me open again. Thanks, Jim. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]