commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Poulter (JIRA)" <>
Subject [jira] [Commented] (IO-544) Should FileUtils.copyFile be flushed and synced before comparing file sizes?
Date Thu, 06 Jul 2017 01:23:04 GMT


Sean Poulter commented on IO-544:

Wow, thanks Bernd! I'll pass the ServerFault article on to our server admin so we're aware
of it.

Do you think it's worth follow-up about the SMB bug with Java? There's a closed [Java Bug
about an incorrect File.length|]
from 2003 that suggested getting the FileDescriptor and calling sync() could fix a similar
issue, but result in serious performance degradation. 

As for Files.copy(), we'll give it a go and hopefully not have to worry about unexpected error

> Should FileUtils.copyFile be flushed and synced before comparing file sizes?
> ----------------------------------------------------------------------------
>                 Key: IO-544
>                 URL:
>             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|]
> * [FileChannel#force(boolean)|]
> * [IO-443 - FileUtils.copyFile methods throw an unnecessary "Failed to copy full contents
from" exception|]
> Thanks,
> Sean

This message was sent by Atlassian JIRA

View raw message