title: Cassandra opens too many files - possible file descriptor leak
body: <p>I'm very new to Cassandra, and I want to test it on a single node, and as soon as I build it on a CentOS server it opens hundreds of thousand files. When I run <code>lsof | grep java | wc -l</code> I get more than 140000, and if I start a client connection and run queries the number of descriptors goes up and up and up to nearly a million at which point the server stops. I have tried scrubbing the SSTables using <code>nodetool</code> and <code>sstablescrub</code>, I have tried deleting the data from <code>/var/lib/cassandra/data/</code> but I still get more than 50000 file descriptors open as soon as I build the Cassandra node. I have noticed in the <code>lsof</code> result that I have only one process ID (PID), but I have hundreds of process group IDs (PGID). Is that expected? Is it related to the number of nodes? The file descriptors for each process group are identical. Here is a small sample of how data seems duplicated: </p>
  
  <pre><code>java      20595 20654      root  198u  a_inode                0,9           0       6999 [eventpoll]
  java      20595 20654      root  199u  a_inode                0,9           0       6999 [eventfd]
  ...
  java      20595 20655      root  198u  a_inode                0,9           0       6999 [eventpoll]
  java      20595 20655      root  199u  a_inode                0,9           0       6999 [eventfd]
  ...
  java      20595 20656      root  198u  a_inode                0,9           0       6999 [eventpoll]
  java      20595 20656      root  199u  a_inode                0,9           0       6999 [eventfd]
  .... and so on.
  </code></pre>
  
  <p>There also other file descriptors like:</p>
  
  <pre><code>java      20595 20655      root  mem       REG              253,1       32296  201350741 /usr/lib64/libffi.so.6.0.1
  </code></pre>
  
  <p>Which show up that many times as well.</p>
  
  <p>Is the installation corrupt or is Cassandra misconfigured?</p>
  
  <p>I have read the documentation from DataStax here: <a href="http://docs.datastax.com/en/cassandra/1.2/cassandra/troubleshooting/trblshootTooManyFiles_r.html" rel="nofollow">http://docs.datastax.com/en/cassandra/1.2/cassandra/troubleshooting/trblshootTooManyFiles_r.html</a>,</p>
  
  <p>And I have read almost all similar questions as it seems that it is a fairly common problem, but I don't think the exact same question has been raised anywhere.</p>