[ 
https://issues.apache.org/jira/browse/LUCENE-8843?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16860657#comment-16860657
 ] 

ASF subversion and git services commented on LUCENE-8843:
---------------------------------------------------------

Commit 4fdcb14acf75ad91c33af31038f64ab4af3010ab in lucene-solr's branch 
refs/heads/master from Jason Tedor
[ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=4fdcb14 ]

LUCENE-8843: Only ignore IOException on dirs when invoking force (#706)

Today in the method IOUtils#fsync we ignore IOExceptions when fsyncing a
directory. However, the catch block here is too broad, for example it
would be ignoring IOExceptions when we try to open a non-existent
file. This commit addresses that by scoping the ignored exceptions only
to the invocation of FileChannel#force. This prevents us from
suppressing an exception in case we run into an unexpected issue when
opening the file.

However, fsyncing directories on Windows is not possible. We always
suppressed this by allowing that an AccessDeniedException is thrown when
attemping to open the directory for reading. Yet, per the above, this
suppression also allowed other IOExceptions to be suppressed, and that
should be considered a bug (e.g., not only the directory not existing,
but any filesystem error and other reasons that we might get an access
denied there, like genuine permissions issues). Rather than relying on
exceptions for flow control and continuing to suppress there, we simply
return early if attempting to fsync a directory on Windows (we should
not put this burden on the caller).

> Only ignore IOException on dirs when invoking force
> ---------------------------------------------------
>
>                 Key: LUCENE-8843
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8843
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/other
>            Reporter: Jason Tedor
>            Priority: Major
>
> I think the IOException suppression in IOUtils#fsync when fsyncing 
> directories is too broad, it suppresses any IOException that occurs in this 
> method if isDir is true. For example, it causes exceptions opening 
> non-existent directories, if access is denied to the directory, or general 
> filesystem errors to be suppressed. To me that feels like it could be 
> suppressing application bugs, or at least exceptions an application would 
> want to know about. Instead, the IOException suppression should only apply 
> after we have successfully opened the directory. I submitted a PR to propose 
> a change along these lines: [https://github.com/apache/lucene-solr/pull/706]. 
> Please let me know what you think.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to