Jackrabbit Content Repository
  1. Jackrabbit Content Repository
  2. JCR-3469

Thread interrupt may result in closed index files

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.4.4, 2.5.3
    • Component/s: jackrabbit-core
    • Labels:
      None

      Description

      Interrupting a thread, which is currently performing I/O on Lucene index files, may result in closed index files. Jackrabbit versions prior to 2.4 didn't have that problem because only with the update of Lucene to 3.0.3 in Jackrabbit 2.4 the underlying default for the FSDirectory in Lucene changed from SimpleFSDirectory to NIOFSDirectory. The latter uses a FileChannel to perform concurrent read operations on a single channel, but because of the way how FileChannel is specified an interrupt will result in the FileChannel to be closed.

      This was also discussed on the Lucene mailing list. See: http://lucene.markmail.org/thread/ea7mj2kpdvyuesss

      1. JCR-3469-test.patch
        3 kB
        Marcel Reutegger
      2. JCR-3469.patch
        4 kB
        Marcel Reutegger
      3. JCR-3469.patch
        12 kB
        Marcel Reutegger
      4. JCR-3469-2.4.diff
        9 kB
        Martin Böttcher

        Activity

        Hide
        Marcel Reutegger added a comment -

        Attached patch contains a test reproducing the issue.

        Show
        Marcel Reutegger added a comment - Attached patch contains a test reproducing the issue.
        Hide
        Marcel Reutegger added a comment -

        This patch adds a parameter to the SearchIndex and allows you to switch back to the SimpleFSDirectory.

        The previous test runs successfully when SimpleFSDirectory is enabled.

        Show
        Marcel Reutegger added a comment - This patch adds a parameter to the SearchIndex and allows you to switch back to the SimpleFSDirectory. The previous test runs successfully when SimpleFSDirectory is enabled.
        Hide
        Marcel Reutegger added a comment -

        Please note the test will only fail on non-Windows platforms without configuration changes. On Windows the FSDirectory factory method already picks the SimpleFSDirectory automatically.

        Show
        Marcel Reutegger added a comment - Please note the test will only fail on non-Windows platforms without configuration changes. On Windows the FSDirectory factory method already picks the SimpleFSDirectory automatically.
        Hide
        Alex Parvulescu added a comment -

        > Please note the test will only fail on non-Windows platforms without configuration changes
        Can we leverage the lucene Constants.WINDOWS constant to simply skip the test on windows?

        Show
        Alex Parvulescu added a comment - > Please note the test will only fail on non-Windows platforms without configuration changes Can we leverage the lucene Constants.WINDOWS constant to simply skip the test on windows?
        Hide
        Marcel Reutegger added a comment -

        Good point. Thanks for the suggestion.

        Attached patch now contains both an updated test and changes to support a new 'useSimpleFSDirectory' param.

        Show
        Marcel Reutegger added a comment - Good point. Thanks for the suggestion. Attached patch now contains both an updated test and changes to support a new 'useSimpleFSDirectory' param.
        Hide
        Alex Parvulescu added a comment -

        One more tiny suggestion

        Wouldn't it be easier to extend from AbstractIndexingTest and just switch the flag on before the test and back to its original value after?
        This way the test would have its own dedicated workspace, just like the indexing config test we already have.
        Would that make the test simpler?

        Show
        Alex Parvulescu added a comment - One more tiny suggestion Wouldn't it be easier to extend from AbstractIndexingTest and just switch the flag on before the test and back to its original value after? This way the test would have its own dedicated workspace, just like the indexing config test we already have. Would that make the test simpler?
        Hide
        Alex Parvulescu added a comment -

        ok, it seems that a dedicated workspace would not suffice, as the original problem still touches the default ws.

        +1 for the patch

        Show
        Alex Parvulescu added a comment - ok, it seems that a dedicated workspace would not suffice, as the original problem still touches the default ws. +1 for the patch
        Hide
        Marcel Reutegger added a comment -

        I considered extending from an abstract test class as well, but then noticed
        that I'd have to change the test repository.xml as well to use the SimpleFSDirectory
        for the version storage index. I decided to keep the existing test configuration
        as is because the automatic FSDirectory resolution is still the default.

        Show
        Marcel Reutegger added a comment - I considered extending from an abstract test class as well, but then noticed that I'd have to change the test repository.xml as well to use the SimpleFSDirectory for the version storage index. I decided to keep the existing test configuration as is because the automatic FSDirectory resolution is still the default.
        Hide
        Alex Parvulescu added a comment -

        applied the patch with revision 1415093.

        Show
        Alex Parvulescu added a comment - applied the patch with revision 1415093.
        Hide
        Marcel Reutegger added a comment -

        Test fails on Apache Jenkins.

        Show
        Marcel Reutegger added a comment - Test fails on Apache Jenkins.
        Hide
        Marcel Reutegger added a comment -

        Disabled test for now in revision: 1416387

        Show
        Marcel Reutegger added a comment - Disabled test for now in revision: 1416387
        Hide
        Marcel Reutegger added a comment -

        Looks like this is solaris specific. More background information is available here: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4385444

        On Solaris the HotSpot option UseVMInterruptibleIO is enabled per default with Java 6. This makes I/O behaviour in presence of Thread interrupts platform specific. I'll try to reproduce the test failure on a Solaris instance...

        Show
        Marcel Reutegger added a comment - Looks like this is solaris specific. More background information is available here: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4385444 On Solaris the HotSpot option UseVMInterruptibleIO is enabled per default with Java 6. This makes I/O behaviour in presence of Thread interrupts platform specific. I'll try to reproduce the test failure on a Solaris instance...
        Hide
        Marcel Reutegger added a comment -

        I'm able to reproduce this on Solaris 11.1 (x86). In contrast to NIO, the underlying file is not closed and subsequent queries are successful.

        Updated the test to ignore the RepositoryException if the root cause is a InterruptedIOException.

        svn revision 1416863

        Show
        Marcel Reutegger added a comment - I'm able to reproduce this on Solaris 11.1 (x86). In contrast to NIO, the underlying file is not closed and subsequent queries are successful. Updated the test to ignore the RepositoryException if the root cause is a InterruptedIOException. svn revision 1416863
        Hide
        Martin Böttcher added a comment -

        proposed patch for 2.4

        Show
        Martin Böttcher added a comment - proposed patch for 2.4
        Hide
        Marcel Reutegger added a comment -

        Merged into 2.4 branch in revision: 1429838

        Show
        Marcel Reutegger added a comment - Merged into 2.4 branch in revision: 1429838

          People

          • Assignee:
            Marcel Reutegger
            Reporter:
            Marcel Reutegger
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development