Markus Wichitill wrote:
Perrin Harkins wrote:

Steve Hay wrote:

If I switch to mp2 then the Perl interpreter is now multi-threaded, thus removing the performance bottleneck, which should be great except for one thing: All our mp code involves DBI (& DBD-mysql), but DBI is not thread-safe!


I thought DBI was thread-safe at this point. It's more likely DBD::mysql that is not.


DBD::mysql is thread-safe, if the underlying libmysql is (see DBD::mysql POD). Under Unix, a thread-safe libmysql_r needs to be compiled and linked (not done by default), under Windows, it should always be thread-safe.

Thanks Marcus. I've posted a question to the dbi-dev list to

While I can reproduce the crash with Steve's small script, I haven't had any problems with DBI and DBD::mysql under either WinNT or Worker MPMs in real life.

Cool. So may be the problem is not that bad. The example posted by Steve:

use DBI;
use threads;
my $dsn = 'dbi:mysql:test';
my $usr = 'root';
my $pwd = undef;
my $t = threads->new(\&dbsub);
$t->join();
sub dbsub {
  my $dbh = DBI->connect($dsn, $usr, $pwd);
  $dbh->disconnect();
}

is not a typical case, since it mixes ithreads with perl ithreads, which is far from being perfect (on unix too). so it's quite possible that this problem has nothing to do with DBI, but something that needs to be fixed in the modperl core (we know that perl contexts is a known issue, mainly caused by perl itself, which relies too much on the global context)

Steve, why do you need to run this threads code?

--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to