title: Why Too many open files in Hbase
body: <p>I have configured a 2 node cluster with hadoop and installed hbase. It was working properly and I have run some basic map reduce jobs in hadoop and I was able to create and list some tables in hbase too. However I have few data in hdfs/hbase and there were no job running. After a while I started to get <code>"Java.net.Socket: Too many open files"</code> error in hbase logs. </p>
  
  <p>I have looked for some solutions but there are mainly answers about increasing limit. <em>However I am curious about why there are too many open files</em>. This cluster is not used by any other program and I have not run any job other than simple map reduce tasks in tutorials.</p>
  
  <p><em>Why could it be?</em></p>
  
  <p><strong>EDIT</strong></p>
  
  <p>After Andrzej suggested, I have run this command (<code>lsof | grep java</code>) and I have observed that there are lots of connection in different ports which are waiting to be closed. This is just a few line of the output of the command</p>
  
  <pre><code>java      29872     hadoop  151u     IPv6          158476883      0t0       TCP os231.myIP:44712-&gt;os231.myIP:50010 (CLOSE_WAIT)
  java      29872     hadoop  152u     IPv6          158476885      0t0       TCP os231.myIP:35214-&gt;os233.myIP:50010 (CLOSE_WAIT)
  java      29872     hadoop  153u     IPv6          158476886      0t0       TCP os231.myIP:39899-&gt;os232.myIP:50010 (CLOSE_WAIT)
  java      29872     hadoop  155u     IPv6          158476892      0t0       TCP os231.myIP:44717-&gt;os231.myIP:50010 (CLOSE_WAIT)
  java      29872     hadoop  156u     IPv6          158476895      0t0       TCP os231.myIP:44718-&gt;os231.myIP:50010 (CLOSE_WAIT)
  </code></pre>
  
  <p>Now the question becomes, why do not they close automatically if the connection is useless now? If they do not get aborted automatically, is there any way to close them with a crontab script or something similar?</p>
  
  <p>Thanks</p>