Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DBD-Oracle CPAN distribution.

Report information
The Basics
Id: 64524
Status: resolved
Priority: 0/
Queue: DBD-Oracle

People
Owner: Nobody in particular
Requestors: miklas [...] officeit.nl
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 1.23
  • 1.24a
  • 1.26
  • 1.27
Fixed in: 1.28



Subject: Memory Leak when Oracle connection fails
Download (untitled) / with headers
text/plain 1.4k
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
Download (untitled) / with headers
text/plain 1.8k
On Thu Jan 06 03:28:26 2011, miklas wrote: Show quoted text
> 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 Show quoted text
> 2010 i686 GNU/Linux > > Compiled against Oracle Instant Client > Client Shared Library 32-bit - 11.2.0.1.0
Thanks for your report. Just to let you know I have confirmed your findings and valgrind is pointing at ora_db_login6. I hope to find time to investigate in the next few days. Martin -- Martin J. Evans Wetherby, UK
Download (untitled) / with headers
text/plain 2.6k
On Thu Jan 13 05:25:55 2011, MJEVANS wrote: Show quoted text
> On Thu Jan 06 03:28:26 2011, miklas wrote:
> > 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 Show quoted text
> > 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
> > Thanks for your report. Just to let you know I have confirmed your > findings and valgrind is pointing at ora_db_login6. I hope to find
time Show quoted text
> to investigate in the next few days. > > Martin
Hi, It would appear to be a missing call to OCIHandleFree when OCISessionBegin fails. You can apply the following patch to fix: Index: dbdimp.c =================================================================== --- dbdimp.c (revision 14638) +++ dbdimp.c (working copy) @@ -907,6 +907,7 @@ OCIHandleFree_log_stat(imp_dbh->srvhp, OCI_HTYPE_SERVER, status); OCIHandleFree_log_stat(imp_dbh->errhp, OCI_HTYPE_ERROR, status); OCIHandleFree_log_stat(imp_dbh->svchp, OCI_HTYPE_SVCCTX, status); + OCIHandleFree_log_stat(imp_dbh->envhp, OCI_HTYPE_ENV, status); return 0; } Please let me know how it goes. Martin -- Martin J. Evans Wetherby, UK
From: miklas [...] officeit.nl
Download (untitled) / with headers
text/plain 3.5k
On Thu Jan 13 06:02:51 2011, MJEVANS wrote: Show quoted text
> On Thu Jan 13 05:25:55 2011, MJEVANS wrote:
> > On Thu Jan 06 03:28:26 2011, miklas wrote:
> > > 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 Show quoted text
> > UTC
> > > 2010 i686 GNU/Linux > > > > > > Compiled against Oracle Instant Client > > > Client Shared Library 32-bit - 11.2.0.1.0
> > > > Thanks for your report. Just to let you know I have confirmed your > > findings and valgrind is pointing at ora_db_login6. I hope to find
> time
> > to investigate in the next few days. > > > > Martin
> > Hi, > > It would appear to be a missing call to OCIHandleFree when > OCISessionBegin fails. You can apply the following patch to fix: > > Index: dbdimp.c > =================================================================== > --- dbdimp.c (revision 14638) > +++ dbdimp.c (working copy) > @@ -907,6 +907,7 @@ > > OCIHandleFree_log_stat(imp_dbh->srvhp, OCI_HTYPE_SERVER, status); > > OCIHandleFree_log_stat(imp_dbh->errhp, OCI_HTYPE_ERROR, status); > > OCIHandleFree_log_stat(imp_dbh->svchp, OCI_HTYPE_SVCCTX, status); > + > OCIHandleFree_log_stat(imp_dbh->envhp, OCI_HTYPE_ENV, status); > return 0; > } > > Please let me know how it goes. > > Martin
Martin, Just applied your patch to version DBD::Oracle 1.27 and it resolved the memory leak ! Before the patch: ./debug.pl 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 After the patch was applied: ./debug.pl VmRSS: 9956 kB VmRSS: 9964 kB VmRSS: 9968 kB VmRSS: 9968 kB VmRSS: 9968 kB VmRSS: 9968 kB VmRSS: 9968 kB VmRSS: 9968 kB VmRSS: 9968 kB VmRSS: 9968 kB You've resolved the problem ! Thank you very much, Kind regards, Miklas
Download (untitled) / with headers
text/plain 933b
On Thu Jan 13 11:54:28 2011, miklas wrote: Show quoted text
> Martin, > > Just applied your patch to version DBD::Oracle 1.27 and it resolved the > memory leak ! > > Before the patch: > > ./debug.pl > 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 > > After the patch was applied: > > ./debug.pl > VmRSS: 9956 kB > VmRSS: 9964 kB > VmRSS: 9968 kB > VmRSS: 9968 kB > VmRSS: 9968 kB > VmRSS: 9968 kB > VmRSS: 9968 kB > VmRSS: 9968 kB > VmRSS: 9968 kB > VmRSS: 9968 kB > > You've resolved the problem ! > Thank you very much, > > Kind regards, > > Miklas
Miklas, It is just a temporary fix and possibly won't work if you are using ora_envhp - I need to look in to it further. Will keep you posted. Martin -- Martin J. Evans Wetherby, UK
From: miklas [...] officeit.nl
Download (untitled) / with headers
text/plain 1.8k
On Thu Jan 13 14:13:21 2011, MJEVANS wrote: Show quoted text
> On Thu Jan 13 11:54:28 2011, miklas wrote: >
> > Martin, > > > > Just applied your patch to version DBD::Oracle 1.27 and it resolved
the Show quoted text
> > memory leak ! > > > > Before the patch: > > > > ./debug.pl > > 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 > > > > After the patch was applied: > > > > ./debug.pl > > VmRSS: 9956 kB > > VmRSS: 9964 kB > > VmRSS: 9968 kB > > VmRSS: 9968 kB > > VmRSS: 9968 kB > > VmRSS: 9968 kB > > VmRSS: 9968 kB > > VmRSS: 9968 kB > > VmRSS: 9968 kB > > VmRSS: 9968 kB > > > > You've resolved the problem ! > > Thank you very much, > > > > Kind regards, > > > > Miklas
> > Miklas, > > It is just a temporary fix and possibly won't work if you are using > ora_envhp - I need to look in to it further. Will keep you posted. > > Martin
Hi Martin, Don't know if this wil help but I modified the test perl script to include the ora_envph option. #!/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, ora_envhp => 0 }) ; my $cmd = "grep VmRSS /proc/$$/status"; print `$cmd`; } Output: $ ./debug.pl VmRSS: 9960 kB VmRSS: 9964 kB VmRSS: 9968 kB VmRSS: 9968 kB VmRSS: 9968 kB VmRSS: 9968 kB VmRSS: 9968 kB VmRSS: 9968 kB VmRSS: 9968 kB VmRSS: 9968 kB It looks like the memory leak is still gone but maybe I'm not using a proper test script for this. Please let me know if there is anything I can do to help you. Miklas
Download (untitled) / with headers
text/plain 2.5k
On Fri Jan 14 02:03:01 2011, miklas wrote: Show quoted text
> On Thu Jan 13 14:13:21 2011, MJEVANS wrote:
> > On Thu Jan 13 11:54:28 2011, miklas wrote: > >
> > > Martin, > > > > > > Just applied your patch to version DBD::Oracle 1.27 and it
resolved Show quoted text
> the
> > > memory leak ! > > > > > > Before the patch: > > > > > > ./debug.pl > > > 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 > > > > > > After the patch was applied: > > > > > > ./debug.pl > > > VmRSS: 9956 kB > > > VmRSS: 9964 kB > > > VmRSS: 9968 kB > > > VmRSS: 9968 kB > > > VmRSS: 9968 kB > > > VmRSS: 9968 kB > > > VmRSS: 9968 kB > > > VmRSS: 9968 kB > > > VmRSS: 9968 kB > > > VmRSS: 9968 kB > > > > > > You've resolved the problem ! > > > Thank you very much, > > > > > > Kind regards, > > > > > > Miklas
> > > > Miklas, > > > > It is just a temporary fix and possibly won't work if you are using > > ora_envhp - I need to look in to it further. Will keep you posted. > > > > Martin
> > Hi Martin, > > Don't know if this wil help but I modified the test perl script to > include the ora_envph option. > > #!/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, ora_envhp => 0 }) ; > my $cmd = "grep VmRSS /proc/$$/status"; > print `$cmd`; > > } > > Output: > > $ ./debug.pl > VmRSS: 9960 kB > VmRSS: 9964 kB > VmRSS: 9968 kB > VmRSS: 9968 kB > VmRSS: 9968 kB > VmRSS: 9968 kB > VmRSS: 9968 kB > VmRSS: 9968 kB > VmRSS: 9968 kB > VmRSS: 9968 kB > > It looks like the memory leak is still gone but maybe I'm not using a > proper test script for this. > Please let me know if there is anything I can do to help you. > > Miklas
The attached patch might be better. env handles are shared between connections unless you specify ora_envhp => 0. You are not seeing a leak with the previous patch because the env handle is freed when the code fails to create a session (connect to Oracle). However, if you connected successfully once, then failed to connect it would free the environment handle the first connection is using - which is broken. I think the attached patch is a better solution but John Scoles will ultimately decide what he applies. Martin -- Martin J. Evans Wetherby, UK
Subject: patch
Download patch
text/plain 1.6k
Index: dbdimp.c =================================================================== --- dbdimp.c (revision 14642) +++ dbdimp.c (working copy) @@ -500,6 +500,7 @@ IV tmp; if (!sv_isa(*svp, "ExtProc::OCIEnvHandle")) croak("ora_envhp value is not of type ExtProc::OCIEnvHandle"); + /* MJE cannot believe the following will work on 64bit platforms */ tmp = SvIV((SV*)SvRV(*svp)); imp_dbh->envhp = (struct OCIEnv *)tmp; } @@ -625,7 +626,10 @@ "OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc."); return 0; } + if (!imp_drh->envhp) /* cache first envhp info drh as future default */ + imp_drh->envhp = imp_dbh->envhp; + svp = DBD_ATTRIB_GET_SVP(attr, "ora_charset", 11);/*get the charset passed in by the user*/ if (svp) { if (!SvPOK(*svp)) { @@ -663,6 +667,8 @@ "OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc"); return 0; } + if (!imp_drh->envhp) /* cache first envhp info drh as future default */ + imp_drh->envhp = imp_dbh->envhp; } /* update the hard-coded csid constants for unicode charsets */ @@ -907,7 +913,7 @@ OCIHandleFree_log_stat(imp_dbh->srvhp, OCI_HTYPE_SERVER, status); OCIHandleFree_log_stat(imp_dbh->errhp, OCI_HTYPE_ERROR, status); OCIHandleFree_log_stat(imp_dbh->svchp, OCI_HTYPE_SVCCTX, status); - OCIHandleFree_log_stat(imp_dbh->envhp, OCI_HTYPE_ENV, status); + /*OCIHandleFree_log_stat(imp_dbh->envhp, OCI_HTYPE_ENV, status);*/ return 0; }
From: miklas [...] officeit.nl
Download (untitled) / with headers
text/plain 3.1k
On Fri Jan 14 03:59:19 2011, MJEVANS wrote: Show quoted text
> On Fri Jan 14 02:03:01 2011, miklas wrote:
> > On Thu Jan 13 14:13:21 2011, MJEVANS wrote:
> > > On Thu Jan 13 11:54:28 2011, miklas wrote: > > >
> > > > Martin, > > > > > > > > Just applied your patch to version DBD::Oracle 1.27 and it
> resolved
> > the
> > > > memory leak ! > > > > > > > > Before the patch: > > > > > > > > ./debug.pl > > > > 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 > > > > > > > > After the patch was applied: > > > > > > > > ./debug.pl > > > > VmRSS: 9956 kB > > > > VmRSS: 9964 kB > > > > VmRSS: 9968 kB > > > > VmRSS: 9968 kB > > > > VmRSS: 9968 kB > > > > VmRSS: 9968 kB > > > > VmRSS: 9968 kB > > > > VmRSS: 9968 kB > > > > VmRSS: 9968 kB > > > > VmRSS: 9968 kB > > > > > > > > You've resolved the problem ! > > > > Thank you very much, > > > > > > > > Kind regards, > > > > > > > > Miklas
> > > > > > Miklas, > > > > > > It is just a temporary fix and possibly won't work if you are
using Show quoted text
> > > ora_envhp - I need to look in to it further. Will keep you posted. > > > > > > Martin
> > > > Hi Martin, > > > > Don't know if this wil help but I modified the test perl script to > > include the ora_envph option. > > > > #!/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, ora_envhp => 0 }) ; > > my $cmd = "grep VmRSS /proc/$$/status"; > > print `$cmd`; > > > > } > > > > Output: > > > > $ ./debug.pl > > VmRSS: 9960 kB > > VmRSS: 9964 kB > > VmRSS: 9968 kB > > VmRSS: 9968 kB > > VmRSS: 9968 kB > > VmRSS: 9968 kB > > VmRSS: 9968 kB > > VmRSS: 9968 kB > > VmRSS: 9968 kB > > VmRSS: 9968 kB > > > > It looks like the memory leak is still gone but maybe I'm not using
a Show quoted text
> > proper test script for this. > > Please let me know if there is anything I can do to help you. > > > > Miklas
> > The attached patch might be better. > > env handles are shared between connections unless you specify
ora_envhp Show quoted text
> => 0. > > You are not seeing a leak with the previous patch because the env
handle Show quoted text
> is freed when the code fails to create a session (connect to Oracle). > However, if you connected successfully once, then failed to connect it > would free the environment handle the first connection is using -
which Show quoted text
> is broken. > > I think the attached patch is a better solution but John Scoles will > ultimately decide what he applies. > > Martin
Martin, I fear that you're latest patch reintroduced the memory leak. $ ./debug.pl VmRSS: 9936 kB VmRSS: 10184 kB VmRSS: 10428 kB VmRSS: 10672 kB VmRSS: 10916 kB VmRSS: 11156 kB VmRSS: 11400 kB VmRSS: 11644 kB VmRSS: 11888 kB VmRSS: 12132 kB Closing the ora_envhp handle seems to be the only working solution. Miklas
On Fri Jan 14 04:54:40 2011, miklas wrote: Show quoted text
> > Martin, > > I fear that you're latest patch reintroduced the memory leak. > > $ ./debug.pl > VmRSS: 9936 kB > VmRSS: 10184 kB > VmRSS: 10428 kB > VmRSS: 10672 kB > VmRSS: 10916 kB > VmRSS: 11156 kB > VmRSS: 11400 kB > VmRSS: 11644 kB > VmRSS: 11888 kB > VmRSS: 12132 kB > > Closing the ora_envhp handle seems to be the only working solution. > > Miklas >
It doesn't for me - VmRSS: 11120 kB VmRSS: 11120 kB VmRSS: 11128 kB VmRSS: 11128 kB VmRSS: 11128 kB VmRSS: 11128 kB VmRSS: 11128 kB VmRSS: 11128 kB VmRSS: 11128 kB VmRSS: 11128 kB I guess you left ora_envhp => 0 in your connect? 1st_connect(does not matter if ora_envhp is 0 or not here) env handle 1 created 2nd connect(ora_envhp => 0) env handle 2 created session fails env handle 2 not freed (for fear of freeing an in use one) Perhaps the solution is to say free the env handle if ora_envhp => 0 and the session fails. I'll have another go. Martin -- Martin J. Evans Wetherby, UK
Subject: patch2
Download patch2
text/plain 2.2k
Index: dbdimp.c =================================================================== --- dbdimp.c (revision 14642) +++ dbdimp.c (working copy) @@ -369,6 +369,7 @@ D_imp_drh_from_dbh; ub2 new_charsetid = 0; ub2 new_ncharsetid = 0; + int forced_new_environment = 0; #if defined(USE_ITHREADS) && defined(PERL_MAGIC_shared_scalar) SV ** shared_dbh_priv_svp ; SV * shared_dbh_priv_sv ; @@ -494,12 +495,14 @@ if ((svp=DBD_ATTRIB_GET_SVP(attr, "ora_envhp", 9)) && SvOK(*svp)) { if (!SvTRUE(*svp)) { imp_dbh->envhp = NULL; /* force new environment */ + forced_new_environment = 1; } #if defined(CAN_USE_PRO_C) else { IV tmp; if (!sv_isa(*svp, "ExtProc::OCIEnvHandle")) croak("ora_envhp value is not of type ExtProc::OCIEnvHandle"); + /* MJE cannot believe the following will work on 64bit platforms */ tmp = SvIV((SV*)SvRV(*svp)); imp_dbh->envhp = (struct OCIEnv *)tmp; } @@ -625,7 +628,10 @@ "OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc."); return 0; } + if (!imp_drh->envhp) /* cache first envhp info drh as future default */ + imp_drh->envhp = imp_dbh->envhp; + svp = DBD_ATTRIB_GET_SVP(attr, "ora_charset", 11);/*get the charset passed in by the user*/ if (svp) { if (!SvPOK(*svp)) { @@ -663,6 +669,8 @@ "OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc"); return 0; } + if (!imp_drh->envhp) /* cache first envhp info drh as future default */ + imp_drh->envhp = imp_dbh->envhp; } /* update the hard-coded csid constants for unicode charsets */ @@ -907,7 +915,8 @@ OCIHandleFree_log_stat(imp_dbh->srvhp, OCI_HTYPE_SERVER, status); OCIHandleFree_log_stat(imp_dbh->errhp, OCI_HTYPE_ERROR, status); OCIHandleFree_log_stat(imp_dbh->svchp, OCI_HTYPE_SVCCTX, status); - OCIHandleFree_log_stat(imp_dbh->envhp, OCI_HTYPE_ENV, status); + if (forced_new_environment) + OCIHandleFree_log_stat(imp_dbh->envhp, OCI_HTYPE_ENV, status); return 0; }
From: miklas [...] officeit.nl
Download (untitled) / with headers
text/plain 1.3k
On Fri Jan 14 05:31:27 2011, MJEVANS wrote: Show quoted text
> On Fri Jan 14 04:54:40 2011, miklas wrote:
> > > > Martin, > > > > I fear that you're latest patch reintroduced the memory leak. > > > > $ ./debug.pl > > VmRSS: 9936 kB > > VmRSS: 10184 kB > > VmRSS: 10428 kB > > VmRSS: 10672 kB > > VmRSS: 10916 kB > > VmRSS: 11156 kB > > VmRSS: 11400 kB > > VmRSS: 11644 kB > > VmRSS: 11888 kB > > VmRSS: 12132 kB > > > > Closing the ora_envhp handle seems to be the only working solution. > > > > Miklas > >
> > It doesn't for me - > > VmRSS: 11120 kB > VmRSS: 11120 kB > VmRSS: 11128 kB > VmRSS: 11128 kB > VmRSS: 11128 kB > VmRSS: 11128 kB > VmRSS: 11128 kB > VmRSS: 11128 kB > VmRSS: 11128 kB > VmRSS: 11128 kB > > I guess you left ora_envhp => 0 in your connect? > > 1st_connect(does not matter if ora_envhp is 0 or not here) > env handle 1 created > 2nd connect(ora_envhp => 0) > env handle 2 created > session fails > env handle 2 not freed (for fear of freeing an in use one) > > Perhaps the solution is to say free the env handle if ora_envhp => 0
and Show quoted text
> the session fails. I'll have another go. > > Martin
Hi Martin, You're absolutely right, I tested with an unpatched 1.27 DBD::Oracle version. Just reinstalled the patch and it worked as promised, my mistake. Miklas


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.