fmgoncalves/p5-cassandra-simple — Issue #11: ResourcePool errors
Author: neonknight
Created: 2012-03-01 16:03:04+00:00
State: open

I have discovered hardly reproducable ResourcePool errors under load/parallel access to cassandra. Unfortunately, I have too little Perl knowledge to find the culprit myself. This is the error I get:
```
Use of uninitialized value $_[0] in sprintf at /usr/local/share/perl5/ResourcePool.pm line 247, line 3.
ResourcePool(): got failed resource from client
Use of uninitialized value $_[1] in sprintf at /usr/local/share/perl5/ResourcePool/LoadBalancer.pm line 307, line 3.
Use of uninitialized value $_[0] in sprintf at /usr/local/share/perl5/ResourcePool.pm line 247, line 3.
ResourcePool(): Downsizing
ResourcePool: Downsized... still 0 open (0)
```
I'm getting this error while connecting, reading, writing... Maybe you can give me a few pointers where to investigate further.

The number of errors could be reduced by increasing the *Max* option in *ResourcePool->new()* (I simply hardcoded a value of 256 instead of 5 in RessourcePool.pm).

This is how I connect to my cassandra cluster:
```perl
my $conn = Cassandra::Simple->new(keyspace => 'mykeyspace', server_name => '192.168.0.31', pool_from_ring => 0);
$conn->pool->add_pool('mykeyspace', '192.168.0.32');
$conn->pool->add_pool('mykeyspace', '192.168.0.33');
```
However, after the queries my application simply quits. Maybe my application gets stuck because of lingering connections. Is there a way to properly disconnect from cassandra?
Should I randomize to which server I connect first?