develooper Front page | perl.perl5.porters | Postings from October 2003

[perl #24368] seg faults when deleting keys of shared hash refs

Thread Next
Jack Steadman
October 30, 2003 21:10
[perl #24368] seg faults when deleting keys of shared hash refs
Message ID:
# New Ticket Created by  Jack Steadman 
# Please include the string:  [perl #24368]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from,
generated with the help of perlbug 1.34 running under perl v5.8.1.

[Please enter your report here]

I submitted this bug as an aside to bug report #24255, which has been
resolved.  This probably should have been its own bug report, since it 
was not the same issue as was reported in 24255.  At any rate, I'm 
resubmitting it now as its own ticket.

The following code seg faults on the first 'delete $top->{mid}->{$i};':


use strict;
use threads;
use threads::shared;
use Thread::Queue;

my $top = &share({});
$top->{mid} = &share({});

my $i = 0;
my $state = 1;
while (1) {
	## any reference to a shared object/hash/array
	my $queue = new Thread::Queue;
	if ($state) {
		print "adding key $i\n";
		$top->{mid}->{$i} = $queue;
	} else {
		print "deleting key $i\n";
		delete $top->{mid}->{$i};
	if ($i > 10) {
		$i = 0;
		$state = ($state) ? 0 : 1;

This may only be a problem when deleting keys whose values are 
references.  I'm not sure if it seg faults on scalar values as 

Please let me know if I left out any relevant info.

[Please do not change anything below this line]
Site configuration information for perl v5.8.1:

Configured by twells at Fri Oct 17 18:19:07 EDT 2003.

Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration:
    osname=linux, osvers=2.4.20-20.9smp, archname=i686-linux-thread-multi
    uname='linux mattapan 2.4.20-20.9smp #1 smp mon aug 18 11:32:15 edt 2003 i686 i686 i386 gnulinux '
    hint=previous, 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
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm'
    ccversion='', gccversion='3.2.2 20030222 (Red Hat Linux 3.2.2-5)', 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='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:

@INC for perl v5.8.1:

Environment for perl v5.8.1:
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About