[
https://issues.apache.org/jira/browse/LUCENE-8663?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dawid Weiss resolved LUCENE-8663.
---------------------------------
Resolution: Fixed
> NRTCachingDirectory.slowFileExists may open a file while it's inaccessible
> --------------------------------------------------------------------------
>
> Key: LUCENE-8663
> URL: https://issues.apache.org/jira/browse/LUCENE-8663
> Project: Lucene - Core
> Issue Type: Bug
> Reporter: Dawid Weiss
> Assignee: Dawid Weiss
> Priority: Minor
> Fix For: master (9.0)
>
> Attachments: LUCENE-8663.patch
>
>
> This build:
> https://builds.apache.org/job/Lucene-Solr-NightlyTests-master/1761/consoleText
> failed with the following stack trace:
> {code}
> FAILED: org.apache.lucene.util.TestOfflineSorter.testThreadSafety
> Error Message:
> Captured an uncaught exception in thread: Thread[id=2665, name=Thread-2493,
> state=RUNNABLE, group=TGRP-TestOfflineSorter]
> Stack Trace:
> com.carrotsearch.randomizedtesting.UncaughtExceptionError: Captured an
> uncaught exception in thread: Thread[id=2665, name=Thread-2493,
> state=RUNNABLE, group=TGRP-TestOfflineSorter]
> Caused by: java.lang.RuntimeException: java.nio.file.AccessDeniedException:
> Can't open a file still open for writing: unsorted_tmp_0.tmp
> at __randomizedtesting.SeedInfo.seed([972EEC94E272C842]:0)
> at
> org.apache.lucene.util.TestOfflineSorter$2.run(TestOfflineSorter.java:271)
> Caused by: java.nio.file.AccessDeniedException: Can't open a file still open
> for writing: unsorted_tmp_0.tmp
> at
> org.apache.lucene.store.ByteBuffersDirectory$FileEntry.openInput(ByteBuffersDirectory.java:250)
> at
> org.apache.lucene.store.ByteBuffersDirectory.openInput(ByteBuffersDirectory.java:222)
> at
> org.apache.lucene.store.NRTCachingDirectory.slowFileExists(NRTCachingDirectory.java:292)
> at
> org.apache.lucene.store.NRTCachingDirectory.createTempOutput(NRTCachingDirectory.java:266)
> at
> org.apache.lucene.store.MockDirectoryWrapper.createTempOutput(MockDirectoryWrapper.java:697)
> at
> org.apache.lucene.util.TestOfflineSorter.checkSort(TestOfflineSorter.java:183)
> at
> org.apache.lucene.util.TestOfflineSorter.access$100(TestOfflineSorter.java:49)
> at
> org.apache.lucene.util.TestOfflineSorter$2.run(TestOfflineSorter.java:267)
> {code}
> The problem in slowFileExists is that it probes for file existence by trying
> to open it in a directory. We don't allow opening files that are still open
> by another thread (for writing), hence the exception thrown is
> AccessDeniedException.
> I couldn't reproduce the problem with the same seed. Takes some luck to hit
> the right scenario in a multi-threaded run.
> The contract for {{Directory.fileLength}} is less strict so a straightforward
> patch is to use that instead.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]