Hi!  I am running ActiveState Perl 5.6.1 and using DBI 1.21 and
DBD-Mysql 1.2200.
    
     I have a small problem with forks and database connections … I run
a simple script that connects to a mysql database , after that it
disconnects and after that is trying to fork! The forked process prints
a simple message and then exits … After that, I get a lovely message
from my beloved Windows’98 that says : “ This program has performed an
illegal operation and will be shut down … And when I hit the “Details”
button .. that’s what I see: “  Perl caused an invalid page fault in
module Perl56.dll at 0167:2800caa6” !
    The script that does all I wrote about above is this one : 
            “use strict;
 use DBI;
 my $dbh = DBI->connect("DBI:mysql:test".
";mysql_read_default_file=$ENV{HOME}/.my.cnf","bogdan","asdzx");
 $dbh->disconnect();
 undef $dbh;
 my $pid;
 if (($pid=fork())==0)
            { print "Son \n";
              exit();
            }
         else
            { 
            print "Parent ...\n";
            }
      „
 
    If I remove the „undef $dbh” statement , in addition I get „Attempt
to free unreferenced scalar” 8 times …
 
    If I remove the „undef $dbh” and „$dbh->disconnect” statements in
addition to the first case the next error :
„Database handle destroyed without explicit disconnect.
 Database handle destroyed without explicit disconnect.
 DBI handle cleared whilst still active. „
 
    If I use the next lines of code 
            „use strict;
 use DBI;
 my $dbh = DBI->connect("DBI:mysql:test".
";mysql_read_default_file=$ENV{HOME}/.my.cnf","bogdan","asdzx");
 my $pid;
 if (($pid=fork())==0)
                  { print "Son \n";
                    $dbh->disconnect();
                    exit();
                  }
    else
                  { 
                    print "Parent ...\n";
                    $dbh->disconnect();
                  }
            „ , I get the next errors : 
„panic: DBI active kids (-1) < 0 or > kids (0) at fork.pl line 9.
 Database handle destroyed without explicit disconnect.
 DBI handle cleared whilst still active. „
      
 
      If someone could give me a hint , I will be very grateful to you! 
           Thank you ! 
               Bogdan Badiu   
 
 
 
 
 


Reply via email to