Java.io.IOException: invalid argument

I have a web application running in cluster mode with a load balancer. It consists of two cats (T1 and T2), addressing only one database. T2 - nfs installed on T1. This is the only problem between both nodes.

I have a java method generating some files. If the request runs on T1, there is no problem, but if the request runs on node 2, I get an exception as follows:

java.io.IOException: Invalid argument
        at java.io.FileOutputStream.close0(Native Method)
        at java.io.FileOutputStream.close(FileOutputStream.java:279)

The corresponding code is as follows:

for (int i = 0; i < dataFileList.size(); i++) {
    outputFileName = outputFolder + fileNameList.get(i);
    FileOutputStream fileOut = new FileOutputStream(outputFileName);                        
    fileOut.write(dataFileList.get(i), 0, dataFileList.get(i).length);
    fileOut.flush();
    fileOut.close();
}

An exception appears in Out.close ()

Any clues?

Louis

+3
source share
3 answers
Finally, I found the reason. At first I notice that this exception does NOT always come at the same point.

  java.io.IOException:        java.io.FileOutputStream.close0 ( )        java.io.FileOutputStream.close(FileOutputStream.java:279)                                   ^^^^^

java.io.IOException: Invalid argument
    at java.io.FileOutputStream.writeBytes(Native Method)
    at java.io.FileOutputStream.write(FileOutputStream.java:260)

Java. NFS. - , DRBD .

, . :

nfs node

cd /tmp
date > /shared/path-to-some-not-mounted-dir/today

will work

cat myBigFile > /shared/path-to-some-not-mounted-dir/today

cat: write error: Invalid argument

, gfs.

+1

.profile :

ulimit –n 2048
+3

dataFileList fileNameList? . , ().

+1
source

Source: https://habr.com/ru/post/1706946/


All Articles