title: File upload/download using nfs-client package not working after n iteration
body: <p>I am using nfs-client package to realize the NFS protocol to connect to the linux server for file upload/download. Basically the purpose is NFS protocol testing .</p>
  <p>This is my sample codebase</p>
  <pre><code>import com.emc.ecs.nfsclient.nfs.io.Nfs3File;
  import com.emc.ecs.nfsclient.nfs.io.NfsFileInputStream;
  import com.emc.ecs.nfsclient.nfs.io.NfsFileOutputStream;
  import com.emc.ecs.nfsclient.nfs.nfs3.Nfs3;
  import com.emc.ecs.nfsclient.rpc.CredentialUnix;
  int thread_count = ctx.getThreadNum();
  String lrandom_name = service_name + &quot;_&quot; + replica_id + &quot;_&quot; + thread_count;
  
  public static void uploadFileToNfs() {
          String localDir = &quot;F:\\look\\&quot;+lrandom_name;
          InputStream inputStream = null;
          OutputStream outputStream = null;
          try {
              //Create a local file object
              File localFile = new File(localDir);
              //Get the file name of the local file, this name is used to create a file with the same name in the specified directory on the remote Nfs server
              String localFileName = localFile.getName();
              Nfs3 nfs3 = new Nfs3(NFS_IP, NFS_DIR, new CredentialUnix(0, 0, null), 3);
              //Create Nfs file object on remote server
              Nfs3File NfsFile = new Nfs3File(nfs3, &quot;/&quot; + localFileName);
              //Open a file input stream
              inputStream = new BufferedInputStream(new FileInputStream(localFile));
              //Open a remote Nfs file output stream and copy the file to the destination
              outputStream = new BufferedOutputStream(new NfsFileOutputStream(NfsFile));
  
              //Buffer memory
              byte[] buffer = new byte[1024];
              while ((inputStream.read(buffer)) != -1) {
                  outputStream.write(buffer);
              }
              System.out.println(&quot;File upload complete!&quot;);
          } catch (Exception ex) {
              ex.printStackTrace();
          } finally {
              try {
                  if (outputStream != null) {
                      outputStream.close();
                  }
                  if (inputStream != null) {
                      inputStream.close();
                  }
              } catch (IOException ex) {
                  ex.printStackTrace();
              }
          }
      }
  </code></pre>
  <p>I am running the script from Jmeter , but after n number of iteration (threaded manner) I am  getting below error. Similar script for File download from NFS is working fine in threaded manner parallelly  .</p>
  <pre><code>com.emc.ecs.nfsclient.nfs.NfsException: rpc error, server: 192.168.0.101, RPC error: RPC call is ACCEPTED, but the status is not success, acceptStat=4
          at com.emc.ecs.nfsclient.rpc.RpcWrapper.handleRpcException(RpcWrapper.java:311)
          at com.emc.ecs.nfsclient.rpc.RpcWrapper.callRpcWrapped(RpcWrapper.java:159)
          at com.emc.ecs.nfsclient.nfs.nfs3.Nfs3.wrapped_sendWrite(Nfs3.java:756)
          at com.emc.ecs.nfsclient.nfs.nfs3.Nfs3.wrapped_sendWrite(Nfs3.java:90)
          at com.emc.ecs.nfsclient.nfs.io.NfsFileBase.write(NfsFileBase.java:866)
          at com.emc.ecs.nfsclient.nfs.io.NfsFileOutputStream.writeBufferToFile(NfsFileOutputStream.java:296)
          at com.emc.ecs.nfsclient.nfs.io.NfsFileOutputStream.write(NfsFileOutputStream.java:262)
          at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
          at java.base/java.io.BufferedOutputStream.write(BufferedOutputStream.java:127)
          at java.base/java.io.FilterOutputStream.write(FilterOutputStream.java:108)
          at java_io_FilterOutputStream$write.call(Unknown Source)
          at com.emc.ecs.nfsclient.nfs.io.Script1.run(Script1.groovy:77)
          at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317)
          at org.codehaus.groovy.jsr223.GroovyCompiledScript.eval(GroovyCompiledScript.java:71)
          at java.scripting/javax.script.CompiledScript.eval(CompiledScript.java:89)
          at org.apache.jmeter.util.JSR223TestElement.processFileOrScript(JSR223TestElement.java:217)
          at org.apache.jmeter.protocol.java.sampler.JSR223Sampler.sample(JSR223Sampler.java:72)
          at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:635)
          at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558)
          at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489)
          at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
          at java.base/java.lang.Thread.run(Thread.java:834)
  </code></pre>
  <p><strong>Update</strong>
  Based on feedback instead of one static file for all Threads(Users) , now I have unique file for each Threads(Users) to upload/download</p>
  <p><strong>Update</strong></p>
  <p>Tried below one more use case randomly picking file from one NFS share folder to other ,same issue coming. Suspecting something wrong with NFS configuration only</p>
  <pre><code>package com.emc.ecs.nfsclient.nfs.io;
  
  import org.junit.Test;
  import com.emc.ecs.nfsclient.nfs.NfsSetAttributes;
  import com.emc.ecs.nfsclient.nfs.io.Nfs3File;
  import com.emc.ecs.nfsclient.nfs.io.NfsFileInputStream;
  import com.emc.ecs.nfsclient.nfs.io.NfsFileOutputStream;
  import com.emc.ecs.nfsclient.nfs.nfs3.Nfs3;
  import com.emc.ecs.nfsclient.rpc.CredentialUnix;
  import java.util.Random;
  
  
  import java.io.IOException;
  
  import org.junit.Test;
  String nfs_folder = vars.get(&quot;nfs_folder&quot;);
  String files_folder = vars.get(&quot;files_folder&quot;);
  String NFS_IP = vars.get(&quot;server_ip&quot;);
  String NFS_DIR = &quot;/&quot;+nfs_folder+&quot;/&quot;+files_folder;
  String NFS_DIR_ROOT = &quot;/&quot;+nfs_folder;
  
  int thread_count = ctx.getThreadNum();
  String service_name = vars.get(&quot;Service_Name&quot;);
  String replica_id = vars.get(&quot;Replica_ID&quot;);
  String lrandom_name = service_name + &quot;_&quot; + replica_id + &quot;_&quot; + thread_count;
  int transfer_size = Integer.parseInt(vars.get(&quot;transfer_size&quot;))
  
  
  InputStream inputStream = null;
  OutputStream outputStream = null;
  try {
    Nfs3 nfs3 = new Nfs3(NFS_IP, NFS_DIR, new CredentialUnix(0, 0, null), 3);
    Nfs3 nfs4 = new Nfs3(NFS_IP, NFS_DIR_ROOT, new CredentialUnix(0, 0, null), 3);
    
    nfsFiles = new Nfs3File(nfs3,&quot;/&quot;);
    List&lt;String&gt; children = nfsFiles.list();
    Random randomGenerator = new Random();
    int fileIndex = randomGenerator.nextInt(children.size());
     OUT.println(fileIndex)
    String NfsFileDir = &quot;/&quot;+children.get(fileIndex);
    OUT.println(children.size())
    OUT.println(children.get(fileIndex))
    //Create Nfs file object on remote server
    Nfs3File nfsFile = new Nfs3File(nfs3, NfsFileDir);
    Nfs3File NfsFile = new Nfs3File(nfs4, &quot;/&quot; + lrandom_name);
    //String localFileName = localDir + lrandom_name;
    //Create a local file object
    //File localFile = new File(localFileName);
    //Open a file input stream
    inputStream = new BufferedInputStream(new NfsFileInputStream(nfsFile));
    //Open a remote Nfs file output stream and copy the file to the destination
    outputStream = new BufferedOutputStream(new NfsFileOutputStream(NfsFile));
  
    //Buffer memory
    byte[] buffer = new byte[transfer_size];
  
    while (inputStream.read(buffer) != -1) {
        outputStream.write(buffer);
    }
    System.out.println(&quot;File copy complete!&quot;);
  } catch (IOException ex) {
    ex.printStackTrace();
  } finally {
    try {
        if (outputStream != null) {
            outputStream.close();
        }
        if (inputStream != null) {
            inputStream.close();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
  }
  </code></pre>