commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Poulter (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IO-544) Should FileUtils.copyFile be flushed and synced before comparing file sizes?
Date Wed, 05 Jul 2017 23:51:00 GMT

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

Sean Poulter commented on IO-544:
---------------------------------

I don't fully understand what you mean about a directory scanning application that is not
triggered after the commit.

We're trying to have that copy a tempfile from Machine1 to a storage on a shared drive on
Machine2. That's it. There are no other applications consuming or scanning the file *but*
there is an antivirus suite running on Machine2. It's a straight forward file transfer as
I see it. From what I can gather, the file transfer is OK but checking the destination file
size returns 0. The disconnect between the result of destFile.length() and the successful
copy is what makes me think it's not waiting for the OS to finish writing (somehow).

> Should FileUtils.copyFile be flushed and synced before comparing file sizes?
> ----------------------------------------------------------------------------
>
>                 Key: IO-544
>                 URL: https://issues.apache.org/jira/browse/IO-544
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.5
>         Environment: Win Server 2008, x86
>            Reporter: Sean Poulter
>
> I've been struggling to troubleshoot intermittent {{IOExceptions}} thrown from {{FileUtils.doCopyFile}}
when copying 2-4KB files from a local temporary file to a network drive. Despite the error,
the file appears on the network drive when I check. Should the output channel/buffer be forced/flushed
before closing, and synchronized before comparing the file lengths? It's a rather intermittent
issue on a relatively high throughput PC so I'd expect there to be more IO latency than normal.
> I found myself referencing:
> * [The source code for FileUtils v2.5|https://commons.apache.org/proper/commons-io/javadocs/api-2.5/src-html/org/apache/commons/io/FileUtils.html]
> * [FileChannel#force(boolean)|https://docs.oracle.com/javase/8/docs/api/java/nio/channels/FileChannel.html#force-boolean-]
> * [IO-443 - FileUtils.copyFile methods throw an unnecessary "Failed to copy full contents
from" exception|https://issues.apache.org/jira/browse/IO-443]
> Thanks,
> Sean



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message