Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Release history for Zonemaster component Zonemaster-Backend


v12.1.1 2026-07-22 (part of Zonemaster v2026.1.1 release)

[Fixes]
- Prevents DB handles to be reused in child processes (#1256);
a regression introduced in the previous release


v12.1.0 2026-06-29 (part of Zonemaster v2026.1 release)

[Release information]
Expand Down
2 changes: 1 addition & 1 deletion lib/Zonemaster/Backend.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Zonemaster::Backend;

our $VERSION = '12.1.0';
our $VERSION = '12.1.1';

use strict;
use warnings;
Expand Down
12 changes: 11 additions & 1 deletion lib/Zonemaster/Backend/DB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ has 'dbhandle' => (
required => 1,
);

has 'dbhandlepid' => (
is => 'rw',
isa => 'Maybe[Int]',
required => 0,
);

=head2 $REQUIRED_SCHEMA_VERSION

A positive integer. The database schema version that this module is compatible with.
Expand Down Expand Up @@ -135,7 +141,10 @@ sub get_db_class {
sub dbh {
my ( $self ) = @_;

if ( $self->dbhandle && $self->dbhandle->ping ) {
# Do not return the DB handle if it belongs to a different process: we
# might have forked and be in the child process. If we are not careful, we
# might be messing with someone else's database connection!
if ( $self->dbhandle && $self->dbhandle->ping && $self->dbhandlepid && $self->dbhandlepid == $$ ) {
return $self->dbhandle;
}

Expand All @@ -162,6 +171,7 @@ sub dbh {
);

$self->dbhandle( $dbh );
$self->dbhandlepid( $$ );

return $self->dbhandle;
}
Expand Down
Loading