Skip Menu |

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

Report information
The Basics
Id: 43448
Status: resolved
Priority: 0/
Queue: DBD-SQLite

Owner: Nobody in particular
Requestors: EARONESTY [...]

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

Subject: forking schema test is flawed
Download (untitled) / with headers
text/plain 1.7k
SQLite specifically prohibits the use of a single database handle across processes: "Under UNIX, you should not carry an open SQLite database across a fork() system call into the child process. Problems will result if you do." Yet that seems to be exactly what the module is testing under t\70schemachange.t Fortunately, it works sometimes. But it fails just as often. Also,the return value for waitpid is less than zero for a success on Windows. So only -1 should be tested as per docs (possibly 0 too can be tested for). Anyway, this patch fixes the problem, at the expense of no longer testing forking - which shouldn't work anyway. The advantage of applying this would be that CPAN testers reports going way up. Many fail for this reason alone. --- DBD-SQLite-1.14\t\70schemachange.t Wed Aug 22 20:11:41 2007 +++ DBD-SQLite-1.14x\t\70schemachange.t Thu Feb 19 14:38:20 2009 @@ -63,6 +63,10 @@ if (!defined($pid = fork())) { die("fork: $!"); } elsif ($pid == 0) { + if ($^O =~ /win32/i) { + # sqlite prohibits thread sharing parent connection + $dbh = DBI->connect($test_dsn, $test_user, $test_password); + } # Child: drop the second table if (!$state) { $dbh->do("DROP TABLE $table2") @@ -74,8 +78,13 @@ } # Parent: wait for the child to finish, then attempt to use the database - Test(waitpid($pid, 0) >= 0) or print("waitpid: $!\n"); + Test(waitpid($pid, 0) != -1) or print("waitpid: $!\n"); + if ($^O =~ /win32/i) { + # schema changed, need to reconnect + $dbh = DBI->connect($test_dsn, $test_user, $test_password); + } + Test($state or $dbh->do("DROP TABLE $table1")) or DbiError($dbh->err, $dbh->errstr);
The schemachange test now disconnects before the fork.

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

Please report any issues with to