Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

circular reference in DBI::DBD::SqlEngine::TieTables #158

Open
rwfranks opened this issue Oct 27, 2024 · 0 comments
Open

circular reference in DBI::DBD::SqlEngine::TieTables #158

rwfranks opened this issue Oct 27, 2024 · 0 comments

Comments

@rwfranks
Copy link

Transcribed verbatim from CPAN RT#125590, warts and all.

Fri Jun 15 08:46:50 2018 davem [...] iabyn.com - Ticket created
Subject: circular reference in DBI::DBD::SqlEngine::TieTables

Date: Fri, 15 Jun 2018 13:46:32 +0100
To: [email protected]
From: Dave Mitchell [email protected]

While debugging an issue with DBD::CSV and/or perl:

https://rt.perl.org/Ticket/Display.html?id=133270

I spotted code in DBI::DBD::SqlEngine::TieTables which appears to
be creating a circular reference, and thus leaking.

DBI::DBD::SqlEngine::TieTables::TIEHASH() creates a tie object hash,
one of whose entries is a reference back to the $dbh handle.

I don't understand this code well enough to be 100% certain its a leak,
but it sure looks like a weaken() is in order.

The following code definitely leaks, although that may be in part due to
a bug in Text::CSV_XS which I have reported separately:

(it requires editing 'f_dir' to point to an untarred DBD-CSV-0.53
directory)

    use strict;
    use warnings;

    use DBI;

    while (1) {
        my $dbh = DBI->connect ("dbi:CSV:", undef, undef, {
            f_schema         => undef,
            f_dir            => '/home/davem/tmp-nobackup/dbd-csv-free/DBD-CSV-0.53/t',
            f_dir_search     => [],
            f_ext            => ".csv/r",
            f_lock           => 2,
            f_encoding       => "utf8",

            csv_auto_diag => 0,

            RaiseError       => 1,
            PrintError       => 1,
            FetchHashKeyName => "NAME_lc",
            }) or die "$DBI::errstr\n" || $DBI::errstr;
    }

--
Art is anything that has a label (especially if the label is "untitled 1")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant