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

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

Thread Next
From:
Jack Steadman
Date:
October 30, 2003 21:10
Subject:
[perl #24368] seg faults when deleting keys of shared hash refs
Message ID:
rt-24368-66763.15.907799932498@rt.perl.org
# New Ticket Created by  Jack Steadman 
# Please include the string:  [perl #24368]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=24368 >



This is a bug report for perl from perlbug@wallofcuriosities.com,
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};':

#!/usr/bin/perl

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};
	}
	
	$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 
well.

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


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=high
---
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:
  Platform:
    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 '
    config_args='-d'
    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
  Compiler:
    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',
    optimize='-O3',
    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/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.3.2'
  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:
    /usr/local/lib/perl5/5.8.1/i686-linux-thread-multi
    /usr/local/lib/perl5/5.8.1
    /usr/local/lib/perl5/site_perl/5.8.1/i686-linux-thread-multi
    /usr/local/lib/perl5/site_perl/5.8.1
    /usr/local/lib/perl5/site_perl
    /usr/lib/perl5/site_perl/5.8.0/i383-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.0
    /usr/lib/perl5/site_perl/5.8.1/i383-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.1
    .

---
Environment for perl v5.8.1:
    HOME=/home/jack
    LANG=C
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
    PERL_BADLANG (unset)
    SHELL=/bin/tcsh


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About