[jira] Created: (LUCENE-674) Error in FSDirectory if java.io.tmpdir incorrectly specified

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (LUCENE-674) Error in FSDirectory if java.io.tmpdir incorrectly specified

Sebastian Nagel (Jira)
Error in FSDirectory if java.io.tmpdir incorrectly specified
------------------------------------------------------------

                 Key: LUCENE-674
                 URL: http://issues.apache.org/jira/browse/LUCENE-674
             Project: Lucene - Java
          Issue Type: Bug
          Components: Store
    Affects Versions: 2.0.0
         Environment: Reported on a Linux system under Tomcat
            Reporter: Ryan Holliday


A user of the JAMWiki project (http://jamwiki.org/) reported an error with the following stack trace:

SEVERE: Unable to create search instance /usr/share/tomcat5/webapps/jamwiki-0.3.4-beta7/test/base/search/indexen
java.io.IOException: Cannot create directory: /temp
        at org.apache.lucene.store.FSDirectory.init(FSDirectory.java:171)
        at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:141)
        at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:117)
        at org.jamwiki.search.LuceneSearchEngine.getSearchIndexPath(LuceneSearchEngine.java:318)

The culprit is that the java.io.tmpdir property was incorrectly specified on the user's system.  Lucene could easily handle this issue by modifying the FSDirectory.init() method.  Currently the code uses the index directory if java.io.tmpdir and org.apache.lucene.lockDir are unspecified, but it could use that directory if those values are unspecified OR if they are invalid.  Doing so would make Lucene a bit more robust without breaking any existing installations.


--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (LUCENE-674) Error in FSDirectory if java.io.tmpdir incorrectly specified

Sebastian Nagel (Jira)
    [ http://issues.apache.org/jira/browse/LUCENE-674?page=comments#action_12436351 ]
           
Hoss Man commented on LUCENE-674:
---------------------------------

This sounds like a very similar issue to some past discussion about the path specified when opening a directory, and what to do if it doesn't exist (ie: create it, or throw an error) ... in general i think it would be unadvisable to assume that if java.io.tmpdir refers to a bogus directory that we should use the index directory, because that could lead to situations were typo result in errors silently being ignored to the possible extend of index corruption.

(consider for a moment: two lucene based apps running in two seperate JVM instances on the same machine, attempting to use hte same index directory; one with a properly set java.io.tmpdir and one without -- they will most likely crash hard because they would wilently use completley differnet directories for managing locks).

As with the discussion about index directories that don't exist, applications that *want* to silenetly assume that a bogus java.io.tmpdir property should result in using the index directory for lock files can get that behavior if they want (by testing java.io.tmpdir themselves, and explicitly constructing a SimpleFSLockFactory() on the directory they want to use) but Lucene should not make any assumptions about what the client application wants in the case of garbage input.

> Error in FSDirectory if java.io.tmpdir incorrectly specified
> ------------------------------------------------------------
>
>                 Key: LUCENE-674
>                 URL: http://issues.apache.org/jira/browse/LUCENE-674
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 2.0.0
>         Environment: Reported on a Linux system under Tomcat
>            Reporter: Ryan Holliday
>
> A user of the JAMWiki project (http://jamwiki.org/) reported an error with the following stack trace:
> SEVERE: Unable to create search instance /usr/share/tomcat5/webapps/jamwiki-0.3.4-beta7/test/base/search/indexen
> java.io.IOException: Cannot create directory: /temp
>         at org.apache.lucene.store.FSDirectory.init(FSDirectory.java:171)
>         at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:141)
>         at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:117)
>         at org.jamwiki.search.LuceneSearchEngine.getSearchIndexPath(LuceneSearchEngine.java:318)
> The culprit is that the java.io.tmpdir property was incorrectly specified on the user's system.  Lucene could easily handle this issue by modifying the FSDirectory.init() method.  Currently the code uses the index directory if java.io.tmpdir and org.apache.lucene.lockDir are unspecified, but it could use that directory if those values are unspecified OR if they are invalid.  Doing so would make Lucene a bit more robust without breaking any existing installations.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (LUCENE-674) Error in FSDirectory if java.io.tmpdir incorrectly specified

Sebastian Nagel (Jira)
In reply to this post by Sebastian Nagel (Jira)
    [ http://issues.apache.org/jira/browse/LUCENE-674?page=comments#action_12436384 ]
           
Ryan Holliday commented on LUCENE-674:
--------------------------------------

I'm not sure if "the user specified the wrong directory" is necessarily the correct situation here.  Unless a user specifically sets the org.apache.lucene.lockDir property, they aren't really choosing the lock directory location - Lucene uses the java.io.tmpdir property as a default, without any input from the user.  A user who runs into this problem will see only something like "Cannot create directory: /temp" in their logs, and then has to go through the source code to figure out why anything is trying to create that directory.

The code already defaults to using the index directory for lock files (which the user DID specify) if the org.apache.lucene.lockDir property and the java.io.tmpdir properties are not set - it doesn't seem like much of a stretch to just modify the code to also use the index directory if at least the java.io.tmpdir property is invalid.

> Error in FSDirectory if java.io.tmpdir incorrectly specified
> ------------------------------------------------------------
>
>                 Key: LUCENE-674
>                 URL: http://issues.apache.org/jira/browse/LUCENE-674
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 2.0.0
>         Environment: Reported on a Linux system under Tomcat
>            Reporter: Ryan Holliday
>
> A user of the JAMWiki project (http://jamwiki.org/) reported an error with the following stack trace:
> SEVERE: Unable to create search instance /usr/share/tomcat5/webapps/jamwiki-0.3.4-beta7/test/base/search/indexen
> java.io.IOException: Cannot create directory: /temp
>         at org.apache.lucene.store.FSDirectory.init(FSDirectory.java:171)
>         at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:141)
>         at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:117)
>         at org.jamwiki.search.LuceneSearchEngine.getSearchIndexPath(LuceneSearchEngine.java:318)
> The culprit is that the java.io.tmpdir property was incorrectly specified on the user's system.  Lucene could easily handle this issue by modifying the FSDirectory.init() method.  Currently the code uses the index directory if java.io.tmpdir and org.apache.lucene.lockDir are unspecified, but it could use that directory if those values are unspecified OR if they are invalid.  Doing so would make Lucene a bit more robust without breaking any existing installations.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [jira] Commented: (LUCENE-674) Error in FSDirectory if java.io.tmpdir incorrectly specified

Chris Hostetter-3
: I'm not sure if "the user specified the wrong directory" is necessarily
: the correct situation here.  Unless a user specifically sets the
: org.apache.lucene.lockDir property, they aren't really choosing the lock
: directory location - Lucene uses the java.io.tmpdir property as a
: default, without any input from the user.  A user who runs into this

It depends on your definition of "user" ... someone is setting the
java.io.tmpdir ... if the lockDir hasn't been explicitly set, and tmpdir
points at a bogus directory, that should be an error.  (just like it
should be an error if lockDir is explicitly set, but points at a bogus
directory)

: problem will see only something like "Cannot create directory: /temp" in
: their logs, and then has to go through the source code to figure out why
: anything is trying to create that directory.
        ...
: The code already defaults to using the index directory for lock files
: (which the user DID specify) if the org.apache.lucene.lockDir property
: and the java.io.tmpdir properties are not set - it doesn't seem like
: much of a stretch to just modify the code to also use the index
: directory if at least the java.io.tmpdir property is invalid.

There is a big differnce between coosing a default in the absense of
input, and making assumptions when input is "bad" ... as i said:
applications that want to make these assumptions can do so, but the Lucene
*library* should not ... the system properties are input just like values
passed to method calls -- we have to respect that input.




-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (LUCENE-674) Error in FSDirectory if java.io.tmpdir incorrectly specified

Sebastian Nagel (Jira)
In reply to this post by Sebastian Nagel (Jira)

     [ https://issues.apache.org/jira/browse/LUCENE-674?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-674.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1

Newer versions of Lucene (since 2.1) now store the lock file in the index directory by default.

> Error in FSDirectory if java.io.tmpdir incorrectly specified
> ------------------------------------------------------------
>
>                 Key: LUCENE-674
>                 URL: https://issues.apache.org/jira/browse/LUCENE-674
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 2.0.0
>         Environment: Reported on a Linux system under Tomcat
>            Reporter: Ryan Holliday
>            Priority: Minor
>             Fix For: 2.1
>
>
> A user of the JAMWiki project (http://jamwiki.org/) reported an error with the following stack trace:
> SEVERE: Unable to create search instance /usr/share/tomcat5/webapps/jamwiki-0.3.4-beta7/test/base/search/indexen
> java.io.IOException: Cannot create directory: /temp
>         at org.apache.lucene.store.FSDirectory.init(FSDirectory.java:171)
>         at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:141)
>         at org.apache.lucene.store.FSDirectory.getDirectory(FSDirectory.java:117)
>         at org.jamwiki.search.LuceneSearchEngine.getSearchIndexPath(LuceneSearchEngine.java:318)
> The culprit is that the java.io.tmpdir property was incorrectly specified on the user's system.  Lucene could easily handle this issue by modifying the FSDirectory.init() method.  Currently the code uses the index directory if java.io.tmpdir and org.apache.lucene.lockDir are unspecified, but it could use that directory if those values are unspecified OR if they are invalid.  Doing so would make Lucene a bit more robust without breaking any existing installations.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]