Skip to content

Commit

Permalink
Stop using Try::Tiny until the perl refcounting problem is identified
Browse files Browse the repository at this point in the history
  • Loading branch information
ribasushi committed Jun 11, 2010
1 parent dc35bbe commit ddfd085
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Revision history for DBIx::Class

* Fixes
- Fix a Storage/$dbh leak introduced by th migration to
Try::Tiny (this is *not* a Try::Tiny bug)

* Misc
- Test suite default on-disk database now checks for Win32
fail-conditions even when running on other OSes
Expand Down
19 changes: 12 additions & 7 deletions lib/DBIx/Class/Storage/DBI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,9 @@ sub _connect {
$DBI::connect_via = 'connect';
}

try {
# FIXME - this should have been Try::Tiny, but triggers a leak-bug in perl(!)
# related to coderef refcounting. A failing test has been submitted to T::T
my $connect_ok = eval {
if(ref $info[0] eq 'CODE') {
$dbh = $info[0]->();
}
Expand Down Expand Up @@ -1195,14 +1197,17 @@ sub _connect {
$dbh->{RaiseError} = 1;
$dbh->{PrintError} = 0;
}
}
catch {
$self->throw_exception("DBI Connection failed: $_")
}
finally {
$DBI::connect_via = $old_connect_via if $old_connect_via;

1;
};

my $possible_err = $@;
$DBI::connect_via = $old_connect_via if $old_connect_via;

unless ($connect_ok) {
$self->throw_exception("DBI Connection failed: $possible_err")
}

$self->_dbh_autocommit($dbh->{AutoCommit});
$dbh;
}
Expand Down

0 comments on commit ddfd085

Please sign in to comment.