You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Kurt George Gjerde <ku...@intermedia.uib.no> on 2004/01/16 11:57:10 UTC

[mp2] DBI failing thread test (win32)

Hi,

Not really mod_perl but maybe the same issues as the recent Storable. 
This was experienced on win32 with the following line-up: Apache/2.0.48 
(Win32) mod_perl/1.99_12-dev Perl/v5.8.2 + DBI/v1.39 DBD/mysql/v2.9002.

The DBI_01.pm (mp2 handler) below complains about "Attempt to free 
unreferenced scalar: SV 0x280bac00 at E:/usr/site/lib/DBI.pm line 626" 
under "heavy" load (try 'ab -n 100 -c 5' or more).

I was unable to recreate the same warnings outside mod_perl 
(dbi_01_test.pl) but got "free to wrong pool" and segfault instead. This 
is just by opening and closing a connection so it's a bit strange, since 
I can do this inside mp2 without any complaints (except when there's 
many threads operating).

You need to put in your own db details in order for these tests to work 
(I used the mysql driver so it may also be specific to that one). Steve, 
do you have any chance to test this?

BTW: I also found threading problems with XML::LibXML and was able to 
reproduce it in pure perl (generating "free to wrong pool" and "attempt 
to free unreferenced scalar"). I've posted this to the perl-xml list. 
Looks like this is a win32 specific problem as well. 
http://aspn.activestate.com/ASPN/Mail/Message/perl-xml/1972902


-Kurt.


- dbi_01_test.pl (pure perl) -

   #!/usr/bin/perl
   use strict;
   use threads;
   use DBI;

   my $DB_DATASOURCE = 'your_datasource';
   my $DB_USER       = 'username';
   my $DB_PASSWORD   = 'password';

   my $t1 = threads->new(\&dbsub);
   $t1->join();

   sub dbsub {
     my $dbh = DBI->connect( $DB_DATASOURCE, $DB_USER, $DB_PASSWORD );
     $dbh->disconnect();
   }
   __END__


- DBI_01.pm (mp2 handler) -

   package MyApache::Test::DBI_01;

   use strict;
   use warnings FATAL => 'all', NONFATAL => 'redefine';
   use Apache::Const -compile => qw(OK);
   use Apache::Log;
   use DBI;

   my $DB_DATASOURCE = 'your_datasource';
   my $DB_USER       = 'username';
   my $DB_PASSWORD   = 'password';

   my $I;
   my $DBH;

   sub handler {
     my $r = shift;
     my $data = {};
     $I++;
     print "DBI_01 [$I]\n";

     unless ($DBH) {
       $DBH = DBI->connect( $DB_DATASOURCE, $DB_USER, $DB_PASSWORD );
     }

     unless ($DBH) {
       $r->log_error(__PACKAGE__ . ': ' . $DBI::errstr);
       print "FAILED!\n";
     } else {
       print "OK\n";

       my $sth = $DBH->prepare("select * from session");
       $sth->execute();
       print $sth->rows() . "\n";
       $sth->finish();

     }

     print "done.\n";
     return Apache::OK;
   }
   1;
   __END__




-- 
Kurt George Gjerde
kurt.gjerde@intermedia.uib.no
ICQ:156792385

InterMedia - New Media / Net Based Learning
University of Bergen, Norway


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] DBI failing thread test (win32)

Posted by Steve Hay <st...@uk.radan.com>.
[I'm posting this to dbi-users for their attention too, since the second 
test script at least looks like a DBI/DBD problem, definitely not mod_perl.]

Hi Kurt,

Kurt George Gjerde wrote:

>Hi,
>
>Not really mod_perl but maybe the same issues as the recent Storable. 
>This was experienced on win32 with the following line-up: Apache/2.0.48 
>(Win32) mod_perl/1.99_12-dev Perl/v5.8.2 + DBI/v1.39 DBD/mysql/v2.9002.
>
>The DBI_01.pm (mp2 handler) below complains about "Attempt to free 
>unreferenced scalar: SV 0x280bac00 at E:/usr/site/lib/DBI.pm line 626" 
>under "heavy" load (try 'ab -n 100 -c 5' or more).
>
I had to try a much heavier load than that to break it ("ab -n 1000 -c 
100" did the trick), but I don't see the error anywhere -- just a popup 
application window.

Here's the stack trace (I'm using apache-2.0.48, perl-5.8.3-RC1, 
DBI-1.40, DBD-mysql-2.9003):
=====
apr_pollset_add(apr_pollset_t * 0x00000000, const apr_pollfd_t * 
0x0012f9f8) line 384 + 6 bytes
write_request(connection * 0x00910068) line 803
start_connect(connection * 0x00910068) line 1285 + 9 bytes
test() line 1671 + 23 bytes
main(int 6, const char * const * 0x00322520) line 2191
mainCRTStartup() line 338 + 17 bytes
KERNEL32! 77e814c7()
=====

This is a different failure to the others.  It could just be an 
out-of-memory error (although I don't see any tasks eating significant 
chunks of memory in Task Manager)?

>
>I was unable to recreate the same warnings outside mod_perl 
>(dbi_01_test.pl) but got "free to wrong pool" and segfault instead. This 
>is just by opening and closing a connection so it's a bit strange, since 
>I can do this inside mp2 without any complaints (except when there's 
>many threads operating).
>
>You need to put in your own db details in order for these tests to work 
>(I used the mysql driver so it may also be specific to that one). Steve, 
>do you have any chance to test this?
>
dbi_01_test.pl does fail for me in the same way that you describe.  It 
looks like the usual problem this time too:

=====
VMem::Free(void * 0x019c0fa0) line 208 + 3 bytes
CPerlHost::Free(void * 0x019c0fa0) line 59 + 34 bytes
PerlMemFree(IPerlMem * 0x00222434, void * 0x019c0fa0) line 302
Perl_safesysfree(void * 0x019c0fa0) line 140 + 26 bytes
perl_destruct(interpreter * 0x0022425c) line 544 + 20 bytes
RunPerl(int 2, char * * 0x00223da8, char * * 0x00222c58) line 206 + 12 bytes
main(int 2, char * * 0x00223da8, char * * 0x00222c58) line 18 + 18 bytes
PERL! mainCRTStartup + 227 bytes
KERNEL32! 77e814c7()
=====

- Steve

>
>BTW: I also found threading problems with XML::LibXML and was able to 
>reproduce it in pure perl (generating "free to wrong pool" and "attempt 
>to free unreferenced scalar"). I've posted this to the perl-xml list. 
>Looks like this is a win32 specific problem as well. 
>http://aspn.activestate.com/ASPN/Mail/Message/perl-xml/1972902
>
>
>-Kurt.
>
>
>- dbi_01_test.pl (pure perl) -
>
>   #!/usr/bin/perl
>   use strict;
>   use threads;
>   use DBI;
>
>   my $DB_DATASOURCE = 'your_datasource';
>   my $DB_USER       = 'username';
>   my $DB_PASSWORD   = 'password';
>
>   my $t1 = threads->new(\&dbsub);
>   $t1->join();
>
>   sub dbsub {
>     my $dbh = DBI->connect( $DB_DATASOURCE, $DB_USER, $DB_PASSWORD );
>     $dbh->disconnect();
>   }
>   __END__
>
>
>- DBI_01.pm (mp2 handler) -
>
>   package MyApache::Test::DBI_01;
>
>   use strict;
>   use warnings FATAL => 'all', NONFATAL => 'redefine';
>   use Apache::Const -compile => qw(OK);
>   use Apache::Log;
>   use DBI;
>
>   my $DB_DATASOURCE = 'your_datasource';
>   my $DB_USER       = 'username';
>   my $DB_PASSWORD   = 'password';
>
>   my $I;
>   my $DBH;
>
>   sub handler {
>     my $r = shift;
>     my $data = {};
>     $I++;
>     print "DBI_01 [$I]\n";
>
>     unless ($DBH) {
>       $DBH = DBI->connect( $DB_DATASOURCE, $DB_USER, $DB_PASSWORD );
>     }
>
>     unless ($DBH) {
>       $r->log_error(__PACKAGE__ . ': ' . $DBI::errstr);
>       print "FAILED!\n";
>     } else {
>       print "OK\n";
>
>       my $sth = $DBH->prepare("select * from session");
>       $sth->execute();
>       print $sth->rows() . "\n";
>       $sth->finish();
>
>     }
>
>     print "done.\n";
>     return Apache::OK;
>   }
>   1;
>   __END__
>
>
>
>
>  
>




------------------------------------------------
Radan Computational Ltd.

The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only.  If you have received this message in error or there are any problems, please notify the sender immediately.  The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden.  Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd.  The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org