Hi,
After noticed my program crashed with out-of-file-descriptor exception I made the following test.
and noticed that on driver 3.7.1 Session.shutdown() may not always close and release the connection.
The test program do the following things:
1. creates a Cluster object
2. loop the following for 1000 times:
2.1. open a session with "system" keyspace
2.2. make queries to "schema_keyspaces" table
2.3. shutdown session
2.4. call "ls /proc/$PID/fd" every 10 loops to print a list of open file descriptors
3. call "ls -l /proc/$PID/fd" to print detailed list of open file descriptors
The testing environment consist 3 boxes:
- ubuntu 12.04 server x3
- apache cassandra 2.2.3
- python 2.7.3 (version shipped with ubuntu)
I ran tests inside virtualenv (1.7.1.2) with two different cassandra-driver version:
2.6.0 and 3.7.1 both driver built with Cython (0.23.4 and 0.24.1 respectively)
I noticed that on driver 3.7.1, after several iterations,
there are few connections left open after Session.shutdown() invoked.
The situation not observed on 2.6.0 driver.
The test program code is pasted at:
The results of both test are pasted at:
In output-371.txt, you can noticed that after 390-th iteration there are more FDs left open:
I checked the left open sockets with `netstat -anp`,
they do link to Cassandra port (9042) on one of the server.
Am I close session in the wrong way ?
Thank you for your advice !