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

[perl #24165] threads async segfaults (5.8.1)

Thread Next
From:
perlbug-followup
Date:
October 8, 2003 22:07
Subject:
[perl #24165] threads async segfaults (5.8.1)
Message ID:
rt-24165-65842.17.8746435742774@rt.perl.org
# New Ticket Created by  Michael J. Pomraning 
# Please include the string:  [perl #24165]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=24165 >


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


-----------------------------------------------------------------
[Please enter your report here]

With async-spawned threads, combinations of $thr->tid() and $thr->join()
can cause segfaults:

  # tid, <delay>, join
  #
  $ perl -Mthreads -le '$t = async {1;}; $t->tid; sleep 2; $_->join for threads->list;'
  Segmentation fault

  # tid, join, tid
  #
  $ perl -Mthreads -le '$t = async {1;}; $t->tid; $t->join; $t->tid;'
  Segmentation fault

  # tid, join, tid, join
  #
  $ perl -Mthreads -le '$t = async {1;}; $t->join; $t->tid; $t->join; $t->tid'
  Thread already joined at -e line 1.
  Segmentation fault

This does _not_ happen if the threads are _not_ created via async{}.  That is,
"threads->create(sub {1;}) ..." in the above examples does not segfault.
FWIW, (abbreviated) ltrace puts the SEGV in perl_destruct:

  ...
  perl_run
  SIGRTMIN
  SIGRTMIN
  "Thread already joined at -e line 1."
  <... perl_run resumed>
  perl_destruct         <--- async{} examples SEGV here, new/create continue
  perl_free
  pthread_mutex_destroy
  exit

(perl-5.8.0-55 from Redhat's Rawhide 3.2-5 does not segfault with the
above async{} examples.)

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=medium
---
Site configuration information for perl v5.8.1:

Configured by mjp at Fri Sep 26 09:06:03 CDT 2003.

Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration:
  Platform:
    osname=linux, osvers=2.4.20-19.7, archname=i686-linux-thread-multi
    uname='linux box.securepipe.com 2.4.20-19.7 #1 tue jul 15 13:44:14 edt 2003 i686 unknown '
    config_args='-dse'
    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='-O2',
    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='2.96 20000731 (Red Hat Linux 7.3 2.96-113)', 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 -lndbm -lgdbm -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.2.5.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.2.5'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/home/mjp/opt/lib/perl5/5.8.1/i686-linux-thread-multi/CORE'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.8.1:
    /home/mjp/opt/lib/perl5/5.8.1/i686-linux-thread-multi
    /home/mjp/opt/lib/perl5/5.8.1
    /home/mjp/opt/lib/perl5/site_perl/5.8.1/i686-linux-thread-multi
    /home/mjp/opt/lib/perl5/site_perl/5.8.1
    /home/mjp/opt/lib/perl5/site_perl
    .

---
Environment for perl v5.8.1:
    HOME=/home/mjp
    LANG=en_US.iso885915
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/mjp/opt/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/mjp/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash


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