Front page | perl.perl5.porters |
Postings from April 2003
[perl #22060] Perl 5.8.0 on FreeBSD 5.0 threads (threads->list) possible bug
From:
perlbug-followup
Date:
April 28, 2003 16:27
Subject:
[perl #22060] Perl 5.8.0 on FreeBSD 5.0 threads (threads->list) possible bug
Message ID:
rt-22060-56169.0.410459884250969@bugs6.perl.org
# New Ticket Created by michael@playground.aronsen.dk
# Please include the string: [perl #22060]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=22060 >
This is a bug report for perl from michael@aronsen.dk,
generated with the help of perlbug 1.34 running under perl v5.8.0.
-----------------------------------------------------------------
[Please enter your report here]
After following perldoc perlthrtut to try out 5.8.0 ithreads, I made a small script that made some threads, printed a number, slept for 1-3 seconds and exits.
Then i used threads->list to iterate over the threads and join() them to close them nicely before the script exits.
I made 200 threads just for fun and noticed the following errormessage:
Attempt to free unreferenced scalar at thr.pl line 30.
I played around a bit and decreased the number of threads, thinking it might memory or the like and noticed that creating 127 or below threads does not produce this error, but anything above does.
Thus it seems threads->list seems to only hold 127 (128?) objects.
Test script follows:
#!/usr/bin/perl -w
use strict;
use threads;
use threads::shared;
$| = 1;
my $childs : shared = 0;
my $maxthr = 127;
for (my $num = 0; $num < $maxthr; $num++){
my $thr = threads->new(\&ttest);
}
sub ttest ($) {
$childs++;
print $childs,"\r";
sleep(int rand(3));
$childs--;
}
foreach my $thr (threads->list) {
if ($thr && $thr->tid && !threads::equal($thr, threads->self)) {
print $thr->tid, "\n";
$thr->join;
}
}
exit 0;
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=medium
---
Site configuration information for perl v5.8.0:
Configured by michael at Sun Apr 27 16:08:32 GMT 2003.
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=freebsd, osvers=5.0-release, archname=i386-freebsd-thread-multi
uname='freebsd playground.aronsen.dk 5.0-release freebsd 5.0-release #0: thu mar 27 01:34:12 cet 2003 root@mail.aronsen.dk:usrsrcsysi386compilemail i386 '
config_args='-sde -Dprefix=/usr/local -Darchlib=/usr/local/lib/perl5/5.8.0/mach -Dprivlib=/usr/local/lib/perl5/5.8.0 -Dman3dir=/usr/local/lib/perl5/5.8.0/man/man3 -Dsitearch=/usr/local/lib/perl5/site_perl/5.8.0/mach -Dsitelib=/usr/local/lib/perl5/site_perl/5.8.0 -Dscriptdir=/usr/local/bin -Ui_malloc -Ui_iconv -Uinstallusrbinperl -Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.0/BSDPAN" -Ui_gdbm -Dusemymalloc=n -Dusethreads=y'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define 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='cc', ccflags ='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.0/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include',
optimize='-O -pipe -mcpu=pentiumpro',
cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.8.0/BSDPAN" -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='3.2.1 [FreeBSD] 20021119 (release)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags ='-pthread -Wl,-E -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lm -lc_r -lcrypt -lutil
perllibs=-lm -lc_r -lcrypt -lutil
libc=, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
---
@INC for perl v5.8.0:
/usr/local/lib/perl5/site_perl/5.8.0/mach
/usr/local/lib/perl5/site_perl/5.8.0
/usr/local/lib/perl5/site_perl
/usr/local/lib/perl5/5.8.0/BSDPAN
/usr/local/lib/perl5/5.8.0/mach
/usr/local/lib/perl5/5.8.0
.
---
Environment for perl v5.8.0:
HOME=/home/michael
LANG (unset)
LANGUAGE (unset)
LC_CTYPE=da_DK.ISO8859-1
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/bin:/usr/X11R6/bin:/home/michael/bin:/home/michael/office52:/home/michael/bin:/usr/local/arch1.0pre11/bin:/usr/local/sbin
PERL_BADLANG (unset)
SHELL=/usr/local/bin/zsh
-
[perl #22060] Perl 5.8.0 on FreeBSD 5.0 threads (threads->list) possible bug
by perlbug-followup