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

"free to wrong memory pool" using DBI, FetchHashKeyName and selectall_hashref #7447

Closed
p5pRT opened this issue Aug 3, 2004 · 8 comments
Closed

Comments

@p5pRT
Copy link

p5pRT commented Aug 3, 2004

Migrated from rt.perl.org#30933 (status was 'open')

Searchable as RT30933$

@p5pRT
Copy link
Author

p5pRT commented Aug 3, 2004

From perl@glob.com.au

morning,

i'm trying to track down a bug that we're experiencing in bugzilla.

http://bugzilla.mozilla.org/show_bug.cgi?id=253696

on activestate perl (windows) build 510 when i connect to a mysql database specifying using

FetchHashKeyName => 'NAME_lc'

and run selectall_hashref() i get

Free to wrong pool 223f88 not ff at e:/Perl/site/lib/DBI.pm line 1867.
my $dbh = DBI->connect(
"DBI:mysql:host=localhost;database=bugs;port=3306", '', '',
{ Username => 'bugs', Password => '', FetchHashKeyName => 'NAME_lc', }
) or die $!;
my $days_since_epoch = int(time() / (60 * 60 * 24));
my $serieses = $dbh->selectall_hashref("SELECT series_id, query, creator " .
"FROM series " .
"WHERE frequency != 0 AND " .
"($days_since_epoch + series_id) % frequency = 0",
"series_id"
);

on activestate perl 5.8.2 build 808, it does not crash.
on activestate perl 5.8.3 build 809, crashes.

nor does it crash if i set FetchHashKeyName to 'NAME' (or don't set it).

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl v5.8.2:

Configured by ActiveState at Tue Dec  9 10:19:27 2003.

Summary of my perl5 (revision 5 version 8 subversion 2) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX',
    optimize='-MD -Zi -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf  -libpath:"D:\Perl\lib\CORE"  -machine:x86'
    libpth=C:\PROGRA~1\MICROS~3\VC98\lib
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib msvcrt.lib
    perllibs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib
    gnulibc_version='undef'
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf  -libpath:"D:\Perl\lib\CORE"  -machine:x86'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY
    21846 Configure gets d_u32align wrong
    21739 [perl #24493] install.html not working
    21737 Ooops. left an XXX comment in, and worse still it's a // comment
    21735 utf8 keys now work for tied hashes
    21734 Accessing unicode keys in tie hashes via hv_exists was broken
    21733 ext/threads/t/problem.t
    21732 Config::myconfig() fails under ithreads
    21728 Update perlhist with 5.6.2
    21723 Include 'SCCS' in the list of dir names ignored by installperl
    21718 Empty subroutine as object method segfaults in 5.8.2 (sometimes)
    21714 Fix bug #24380: assigning list with duplicated keys to a hash
    21706 [perl #24460] [DOC PATCH] the begincheck program
    21693 must copy changes from win32/makeifle.mk to wince/makefile.ce
    21691 Update the list of pumpkings in perlhist.pod
    21687 [PATCH 5.6.2-RC1 pod/perlhist.pod]  Updated
    21677 OS/2 docu
    21676 Bug #24407: key for shared hash got stringified into wrong pool
    21673 Be sure to use -fPIC not -fpic on Linux/SPARC
    21672 extending the hash attack test
    21671 Benchmark.pm cmpthese segfault
    21662 'make minitest' fails for op/cproto and op/pat
    21586 Comment that this 'optimisation' is actually a necessary fixup
    21548 Sync with Pod::Perldoc 3.12
    21540 Fix backward-compatibility issues in if.pm


@INC for perl v5.8.2:
    D:/Perl/lib
    D:/Perl/site/lib
    .


Environment for perl v5.8.2:
    CYGWIN=nontsec
    HOME=D:\Profiles\Byron
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=d:\Program Files\Borland\Delphi7\Bin;d:\Program Files\Borland\Delphi7\Projects\Bpl\;d:\Program Files\Common Files\Borland Shared\BDE\;d:\Program Files\Borland\BDS\2.0\Bin;d:\ruby\bin;d:\Tcl\bin;D:\Python22\.;D:\Perl\bin\;d:\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;d:\PROGRA~1\Borland\Delphi6\Bin;d:\PROGRA~1\Borland\Delphi6\Projects\Bpl;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;D:\PROGRA~1\iNTERFACEWARE Chameleon;D:\Program Files\Microsoft SDK\Bin\.;D:\Program Files\Microsoft SDK\Bin\WinNT\.;C:\Program Files\Support Tools\;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;D:\Program Files\SecureCRT\;d:\Program Files\SecureCRT;D:\Program Files\Microsoft SDK\Bin\.;D:\Program Files\Microsoft SDK\Bin\WinNT\.
    PERL_BADLANG (unset)
    SHELL (unset)


@p5pRT
Copy link
Author

p5pRT commented Nov 2, 2004

From @steve-m-hay

Is there any chance you could upgrade to DBI-1.45 and try this again?

One of the items in the Changes file for that release is​:

- Fixed "Free to wrong pool"/"Attempt to free unreferenced scalar" in FETCH.

so the bug may well be fixed now.

@p5pRT
Copy link
Author

p5pRT commented Nov 2, 2004

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Nov 3, 2004

From guest@guest.guest.xxxxxxxx

sorry, the bug persists​:

H​:\perl>perl -v

This is perl, v5.8.4 built for MSWin32-x86-multi-thread
(with 3 registered patches, see perl -V for more detail)
[snip]

H​:\perl>ppm query dbi
Querying target 1 (ActivePerl 5.8.2.808)
  1. DBI [1.45] Database independent interface for Perl

H​:\perl>perl bug30933.pl
Free to wrong pool 222c58 not ff at D​:/Perl/site/lib/DBI.pm line 1866.

H​:\perl>grep DBI​::VERSION D​:/Perl/site/lib/DBI.pm
File D​:/Perl/site/lib/DBI.pm​:
$DBI​::VERSION = "1.45"; # ==> ALSO update the version in the pod text
below!
[snip]

@p5pRT

This comment has been minimized.

@p5pRT
Copy link
Author

p5pRT commented Mar 30, 2012

From @jochenw

On Mo. 02. Aug. 2004, 19​:21​:13, perl@​glob.com.au wrote​:

on activestate perl 5.8.2 build 808, it does not crash.
on activestate perl 5.8.3 build 809, crashes.

Is this reproducable with a less ancient version of ActiveState Perl, or
anywhere else? The problem is, that ActiveState no longer offers Perl
5.8 for free downloads. In other words, there is no chance to debug it.

Jochen

@toddr
Copy link
Member

toddr commented Feb 13, 2020

mozilla worked around this by doing:

Index: Bugzilla/DB.pm
===================================================================
RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/DB.pm,v
retrieving revision 1.12
diff -u -r1.12 DB.pm
--- Bugzilla/DB.pm	10 Jul 2004 07:35:35 -0000	1.12
+++ Bugzilla/DB.pm	8 Sep 2004 12:47:06 -0000
@@ -152,8 +152,10 @@
                              Password => $db_pass,
                              ShowErrorStatement => 1,
                              HandleError => \&_handle_error,
-                             FetchHashKeyName => 'NAME_lc',
                              TaintIn => 1,
+                             FetchHashKeyName => 'NAME',  
+                             # Note: NAME_lc causes crash on ActiveState Perl
+                             # 5.8.4 (see Bug 253696)
                            });
 
     return $dbh;

@toddr
Copy link
Member

toddr commented Feb 13, 2020

Given no response I'm closing this for now.

@toddr toddr closed this as completed Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants