Skip Menu |

This queue is for tickets about the subs-parallel CPAN distribution.

Report information
The Basics
Id: 46201
Status: open
Priority: 0/
Queue: subs-parallel

People
Owner: Nobody in particular
Requestors: alx.66q [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Memory leak with DBI 1.52 & Oracle - Please Help
Date: Tue, 19 May 2009 13:09:25 +1100
To: bug-subs-parallel [...] rt.cpan.org
From: Алексей <alx.66q [...] gmail.com>
Hi, I'm no Perl expert, but I also would not consider myself a newbie. I seem to have a memory leak issue with the DBI module (1.52) on Windows connecting to Oracle (10gR2). For reasons I won't go into at this time, I need to have a continuous loop that will connect to many Oracle instances. I'm doing this using parallelized subroutine calls and I do have to connect, perform the required queries, and then disconnect inside the parallelized subroutine (leaving a persistent connection unfortunately is not an option). The subroutine calls must be parallelized so they are non-blocking. What I find is that with repeated subsequent database connections, the working set memory continuously grows until the Perl script exhausts all of the memory on the machine. It does go up and down as procedures begin and end, but it also grows over time. I've developed an overly simplified version of my program (shown below) to illustrate/replicate the memory leak. I'm using ActivePerl 5.8.8 (builds 816 and 818). With build 816 (and whatever version of DBI comes with it), the script will run and continue to loop until it crashes from lack of memory due to the leak. Upgrading to build 818, (or build 816 with DBI 1.52 and DBD-Oracle 1.17) still shows the memory leak but also throws an occasional Windows error: "An unhandled win32 exception occurred in perl.exe [5488] ". The strange part is that the unhandled exception error will sometimes come on pretty much any iteration of the loop (sometimes as soon as the 3rd, sometimes as late as the 30th). Here is a simple test script that illustrates the leak, and the unhandled win32 exception (exception is only with the later DBI versions): use strict; use DBI; use subs::parallel; sub DB_Connect : Parallel { print "DB_Connect: parallel subroutine $_[0] is starting\n"; my $dbh = DBI->connect('dbi:Oracle:host=127.0.0.1;sid=ORA1020;port=1521','SYSTEM','MAN AGER',{RaiseError=>0,PrintError=>1,AutoCommit=>0}); print "Connected to Database\n"; $dbh->disconnect || warn $dbh->errstr; print "DB_Connect: parallel subroutine $_[0] is ending\n"; sleep 4; } main { while (1) { print "Starting Loop\n"; &DB_Connect("A"); &DB_Connect("B"); &DB_Connect("C"); print "Finished Loop\n"; sleep 5 } } Can someone please help me by confirming if this is a true leak/bug with the DBI 1.52 module or am I doing something incorrectly? I don't think that the problem is with subs::parallel since if I take out the DBI calls, the loop will run continuously without error or memory leaks. Help is greatly appreciated - I've been scouring the net for days and see reports of similar problems but reports that they were fixed in 1.52. Help and advise is really appreciated since I can't work out anything that I'm doing wrong. Thanks in advance for any comments or suggestions!!
Hi, Did you ever manage to fix this issue? Unfortunately, I can't test using Oracle, so I can't help much. -Nilson On Mon May 18 22:09:55 2009, alx.66q@gmail.com wrote: Show quoted text
> Hi, I'm no Perl expert, but I also would not consider myself a newbie. I > seem to have a memory leak issue with the DBI module (1.52) on Windows > connecting to Oracle (10gR2). > > > > For reasons I won't go into at this time, I need to have a continuous loop > that will connect to many Oracle instances. I'm doing this using > parallelized subroutine calls and I do have to connect, perform the
required Show quoted text
> queries, and then disconnect inside the parallelized subroutine (leaving a > persistent connection unfortunately is not an option). The subroutine
calls Show quoted text
> must be parallelized so they are non-blocking. > > > > What I find is that with repeated subsequent database connections, the > working set memory continuously grows until the Perl script exhausts
all of Show quoted text
> the memory on the machine. It does go up and down as procedures begin and > end, but it also grows over time. I've developed an overly simplified > version of my program (shown below) to illustrate/replicate the memory
leak. Show quoted text
> > > > I'm using ActivePerl 5.8.8 (builds 816 and 818). With build 816 (and > whatever version of DBI comes with it), the script will run and
continue to Show quoted text
> loop until it crashes from lack of memory due to the leak. Upgrading to > build 818, (or build 816 with DBI 1.52 and DBD-Oracle 1.17) still
shows the Show quoted text
> memory leak but also throws an occasional Windows error: "An unhandled
win32 Show quoted text
> exception occurred in perl.exe [5488] ". The strange part is that the > unhandled exception error will sometimes come on pretty much any iteration > of the loop (sometimes as soon as the 3rd, sometimes as late as the 30th). > > > > Here is a simple test script that illustrates the leak, and the unhandled > win32 exception (exception is only with the later DBI versions): > > > > use strict; > > use DBI; > > use subs::parallel; > > > > sub DB_Connect : Parallel { > > print "DB_Connect: parallel subroutine $_[0] is starting\n"; > > my $dbh = >
DBI->connect('dbi:Oracle:host=127.0.0.1;sid=ORA1020;port=1521','SYSTEM','MAN Show quoted text
> AGER',{RaiseError=>0,PrintError=>1,AutoCommit=>0}); > > print "Connected to Database\n"; > > $dbh->disconnect || warn $dbh->errstr; > > print "DB_Connect: parallel subroutine $_[0] is ending\n"; > > sleep 4; > > } > > > > main { > > while (1) { > > print "Starting Loop\n"; > > &DB_Connect("A"); > > &DB_Connect("B"); > > &DB_Connect("C"); > > print "Finished Loop\n"; > > sleep 5 > > } > > } > > > > Can someone please help me by confirming if this is a true leak/bug
with the Show quoted text
> DBI 1.52 module or am I doing something incorrectly? I don't think
that the Show quoted text
> problem is with subs::parallel since if I take out the DBI calls, the loop > will run continuously without error or memory leaks. > > > > Help is greatly appreciated - I've been scouring the net for days and see > reports of similar problems but reports that they were fixed in 1.52. > Help and advise is really appreciated since I can't work out anything that > I'm doing wrong. > > > > Thanks in advance for any comments or suggestions!!