RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1575875 - Java API Files.copy cause an incomplete file, and not throw exceptions.
Summary: Java API Files.copy cause an incomplete file, and not throw exceptions.
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: java-1.8.0-openjdk
Version: 7.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Andrew John Hughes
QA Contact: zzambers
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-08 07:20 UTC by sfu@redhat.com
Modified: 2021-06-10 16:05 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-11-15 20:14:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description sfu@redhat.com 2018-05-08 07:20:42 UTC
Description of problem:
With openjdk8, Files.copy cause an incomplete file,and not throw any exception.
copy a file from a nfs mount directory A to a nfs mount directory B. 
if B has no enough space, the FileCopy.java will not fail,and not throw any exception.Just left an incomplete file there.


Version-Release number of selected component (if applicable):
RHEL 7.4 + NFS
openjdk version "1.8.0_171"
--nfs-server-host: 
vim /etc/exports:
/home/test/ * (rw,sync,no_wdelay,no_root_squash)
--nfs client:
mount command:
mount -t nfs -o rw,bg,soft,intr,timeo=300,vers=4 10.11.12.13:/home/test/source /home/test/source
mount -t nfs -o rw,bg,soft,intr,timeo=300,vers=4 10.11.12.13:/home/test/target  /home/test/target

Java code (FileCopy.java) like:
~~~~~~~~~~~~~~~~~~~~~~
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;

/**
 */
public class FileCopy {
    public static  void main(String[] args) throws IOException {

        //the source file size is 190mb
        String source ="/home/test/source/190MB.txt";

        //the target dir has 90mb  free space
        String target = "/home/test/target/tar.txt";
        Path sourcePath = Paths.get(source);
        Path targetPath = Paths.get(target);

        Files.copy(sourcePath,targetPath, StandardCopyOption.COPY_ATTRIBUTES);

    }
}
~~~~~~~~~~~~~~~~~~~~~~


How reproducible:
Always


Steps to Reproduce:
1.mount a nfs dir
2.execute java class

Actual results:
No error or exception throw by java,just left a incomplete file

Expected results:
Java throw exception like:
Exception in thread "main" java.nio.file.FileSystemException: /root/file2 -> /test/file2.tar: Input/output error
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
	at sun.nio.fs.UnixCopyFile.copyFile(UnixCopyFile.java:253)
	at sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:581)
	at sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:253)
	at java.nio.file.Files.copy(Files.java:1274)
	at FileCopy.main(FileCopy.java:20)

Additional info:

Just happened in nfs dir.


Note You need to log in before you can comment on or make changes to this bug.