title: tar command stuck while generating tar file from java process
body: <p>Running below command using Runtime <code>exec()</code> method to generate tar of a directory using java</p>
  
  <pre><code>tar -zcvf dest.tar.gz -C dirTotar .
  </code></pre>
  
  <p>Java code for tar creation</p>
  
  <pre><code>    String command = "tar -zcvf dest.tar.gz -C dirTotar .";
      Process process = Runtime.getRuntime().exec(command);
      process.waitFor()
      return process.exitValue();
  </code></pre>
  
  <p>Java process is a server which creates tar file after processing after each input. After processing for few input, process is stuck at tar step. </p>
  
  <p>Ran <code>strace -p</code> to find if process is stuck and it shows below output </p>
  
  <pre><code>strace -p 6782 
  Process 6782 attached - interrupt to quit 
  write(1, "./file"..., 66
  </code></pre>
  
  <p>I ran the tar command manually for the input directory and it works perfectly. Any pointers why this is happening?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>For directory structure like below</p>
  
  <pre><code>/tmp/dir1
  /tmp/dir2
  /tmp/dir3
  .
  .
  </code></pre>
  
  <p>Directory for which tar is being generated by process is dir1. There are other process which are generating tar for dir2, dir3... </p>
  
  <p>When process generating tar for dir1 is stuck one of the other process trying to tar other directory (dir2, dir3) is also stuck. Can this be cause of issue?</p>