Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-7959

Throw more helpful error messages from failures in obtainFSLock, at least in NativeFSLockFactory

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.1, master (8.0)
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      This is one of those small changes that would save a lot of pain for end users.

      Let's say that there's a permissions issue with the index dir. The user will get "NoSuchFileException: write.lock" but not understand why the lock file is missing (its because it could not be created). This is an unhelpful/misleading error message (recent user's list discussion about this).

      The problem is that when we try to create the lock file we swallow all exceptions, not just the one we don't care about (Thanks Shawn Heisey for pointing this out).

      {{
      try

      { Files.createFile(lockFile); }

      catch (IOException ignore)

      { // we must create the file to have a truly canonical path. // if it's already created, we don't care. if it cant be created, it will fail below. }

      }}

      It fails later with NoSuchFileException, which does not provide enough information.

        Attachments

        1. LUCENE-7959_untested.patch
          1 kB
          Robert Muir
        2. LUCENE-7959.patch
          4 kB
          Robert Muir

          Activity

            People

            • Assignee:
              erickerickson Erick Erickson
              Reporter:
              erickerickson Erick Erickson
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: