Subject: | Memory Leak when Oracle connection fails |
Hello,
We are building a perl daemon for monitoring purposes.
In the case of a database down event we try to reconnect to the
instance until it's back online.
It looks like some memory is lost every time we fail to connect in the
DBD::Oracle versions after 1.22.
The following code should be able to reproduce the problem.
The database and listener have been shutdown prior to the test.
#!/usr/bin/perl -w
use strict ;
use DBI ;
my $count = 0 ;
while ( $count < 10 ) {
$count++;
my $dbh = DBI->connect("DBI:Oracle:host=localhost;sid=XE;port=1521",
'user', 'password',{ PrintError => 0 }) ;
my $cmd = "grep VmRSS /proc/$$/status";
print `$cmd`;
}
DBD::Oracle 1.23 - 1.27 seam to suffer from the same problem.
Output using 1.27
VmRSS: 9940 kB
VmRSS: 10192 kB
VmRSS: 10436 kB
VmRSS: 10680 kB
VmRSS: 10924 kB
VmRSS: 11164 kB
VmRSS: 11408 kB
VmRSS: 11652 kB
VmRSS: 11896 kB
VmRSS: 12140 kB
DBD::Oracle 1.22 was the last version without the memory leak.
Output using 1.22
VmRSS: 9788 kB
VmRSS: 9788 kB
VmRSS: 9792 kB
VmRSS: 9792 kB
VmRSS: 9792 kB
VmRSS: 9792 kB
VmRSS: 9792 kB
VmRSS: 9792 kB
VmRSS: 9792 kB
VmRSS: 9792 kB
perl, v5.10.1 (*) built for i686-linux-gnu-thread-multi
DBI 1.611-1
Ubuntu Maverick 2.6.35-24-generic #42-Ubuntu SMP Thu Dec 2 01:41:57 UTC
2010 i686 GNU/Linux
Compiled against Oracle Instant Client
Client Shared Library 32-bit - 11.2.0.1.0