develooper Front page | perl.perl5.porters | Postings from December 2006

[perl #41106] PerlIO::via isn't thread safe

Thread Next
From:
Bo Lindbergh
Date:
December 18, 2006 15:24
Subject:
[perl #41106] PerlIO::via isn't thread safe
Message ID:
rt-3.6.HEAD-1774-1166464752-541.41106-75-0@perl.org
# New Ticket Created by  Bo Lindbergh 
# Please include the string:  [perl #41106]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41106 >


This is a bug report for perl from blgl@hagernas.com,
generated with the help of perlbug 1.35 running under perl 5.9.5.


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

This outputs "Hello=3DWorld!" as expected but then crashes.

### begin example program
#! /usr/unstable/bin/perl

use strict;
use warnings;
use threads;
use PerlIO::via::QuotedPrint;

open(my $foo,'>&:via(QuotedPrint)',*STDOUT)
     or die "open: $!";
print $foo "Hello=World!\n"
     or die "print: $!";
async {
     print $foo "Hello=from=Thread!\n";
}->join();
### end example program

### begin debugger log
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xabababaf
0x0008f580 in Perl_gv_fetchpvn_flags (my_perl=0x1811400,  
nambeg=0xbfffe520 "UNIVERSAL::", full_len=11, flags=0, sv_type=12) at  
gv.c:815
815                 if (!stash || !SvREFCNT(stash)) /* symbol table  
under destruction */
(gdb) print stash
$1 = (HV *) 0xabababab
(gdb) bt
#0  0x0008f580 in Perl_gv_fetchpvn_flags (my_perl=0x1811400,  
nambeg=0xbfffe520 "UNIVERSAL::", full_len=11, flags=0, sv_type=12) at  
gv.c:815
#1  0x0008ece0 in Perl_gv_stashpvn (my_perl=0x1811400, name=0x2d3bf0  
"UNIVERSAL", namelen=11, create=0) at gv.c:736
#2  0x0008c410 in Perl_gv_fetchmeth (my_perl=0x1811400,  
stash=0x182af64, name=0x71cf34 "GETARG", len=6, level=0) at gv.c:410
#3  0x007167b8 in PerlIOVia_fetchmethod (my_perl=0x1811400,  
s=0x1137e20, method=0x71cf34 "GETARG", save=0x1137e58) at via.xs:46
#4  0x00716948 in PerlIOVia_method (my_perl=0x1811400, f=0x1101954,  
method=0x71cf34 "GETARG", save=0x1137e58, flags=0) at via.xs:72
#5  0x0071ba6c in PerlIOVia_getarg (my_perl=0x1811400, f=0x1101954,  
param=0xbfffebd8, flags=1) at via.xs:576
#6  0x00008ea4 in PerlIOBase_dup (my_perl=0x1811400, f=0x1142a94,  
o=0x1101954, param=0xbfffebd8, flags=1) at perlio.c:2250
#7  0x0071bac8 in PerlIOVia_dup (my_perl=0x1811400, f=0x1142a94,  
o=0x1101954, param=0xbfffebd8, flags=1) at via.xs:583
#8  0x000031ec in PerlIO_fdupopen (my_perl=0x1811400, f=0x1101954,  
param=0xbfffebd8, flags=1) at perlio.c:561
#9  0x001b10f4 in Perl_fp_dup (my_perl=0x1811400, fp=0x1101954,  
type=0 '\0', param=0xbfffebd8) at sv.c:9499
#10 0x00003920 in PerlIO_clone (my_perl=0x1811400, proto=0x1800400,  
param=0xbfffebd8) at perlio.c:673
#11 0x001b9124 in perl_clone (proto_perl=0x1800400, flags=2) at sv.c: 
10868
#12 0x005d70d0 in S_ithread_create (my_perl=0x1800400,  
init_function=0x18354b4, stack_size=0, gimme=0, exit_opt=0,  
params=0x18357e8) at threads.xs:649
#13 0x005da560 in XS_threads_create (my_perl=0x1800400, cv=0x182ad60)  
at threads.xs:930
#14 0x00138fd4 in Perl_pp_goto (my_perl=0x1800400) at pp_ctl.c:2415
#15 0x0027dad0 in Perl_runops_debug (my_perl=0x1800400) at dump.c:1874
#16 0x00056db4 in S_run_body (my_perl=0x1800400, oldscope=1) at  
perl.c:2403
#17 0x000560b4 in perl_run (my_perl=0x1800400) at perl.c:2323
#18 0x00002a28 in main (argc=4, argv=0xbffff804, env=0xbffff818) at  
perlmain.c:113
### end debugger log

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
     category=library
     severity=high
---
Site configuration information for perl 5.9.5:

Configured by blgl at Sat Dec  9 12:49:18 CET 2006.

Summary of my perl5 (revision 5 version 9 subversion 5 patch 29492)  
configuration:
   Platform:
     osname=darwin, osvers=8.8.0, archname=darwin-thread- 
multi-64int-2level
     uname='darwin sunwukung.local 8.8.0 darwin kernel version 8.8.0:  
fri sep 8 17:18:57 pdt 2006; root:xnu-792.12.6.obj~1release_ppc power  
macintosh powerpc '
     config_args=''
     hint=previous, useposix=true, d_sigaction=define
     useithreads=define, usemultiplicity=define
     useperlio=define, d_sfio=undef, uselargefiles=define,  
usesocks=undef
     use64bitint=define, use64bitall=undef, uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp - 
DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include',
     optimize='-g',
     cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp- 
precomp -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include - 
fno-common -DPERL_DARWIN -no-cpp-precomp -DDEBUGGING -fno-strict- 
aliasing -pipe -I/usr/local/include'
     ccversion='', gccversion='4.0.1 (Apple Computer, Inc. build  
5363)', gccosandvers=''
     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=87654321
     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
     ivtype='long long', ivsize=8, nvtype='double', nvsize=8,  
Off_t='off_t', lseeksize=8
     alignbytes=8, prototype=define
   Linker and Libraries:
     ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -L/usr/ 
local/lib'
     libpth=/usr/local/lib /usr/lib
     libs=-ldbm -ldl -lm -lc
     perllibs=-ldl -lm -lc
     libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false,  
libperl=libperl.a
     gnulibc_version=''
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
     cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/ 
usr/local/lib'

Locally applied patches:
     DEVEL

---
@INC for perl 5.9.5:
     /usr/unstable/lib/perl5/5.9.5/darwin-thread-multi-64int-2level
     /usr/unstable/lib/perl5/5.9.5
     /usr/unstable/lib/perl5/site_perl/5.9.5/darwin-thread- 
multi-64int-2level
     /usr/unstable/lib/perl5/site_perl/5.9.5
     .

---
Environment for perl 5.9.5:
     DYLD_LIBRARY_PATH (unset)
     HOME=/Users/blgl
     LANG (unset)
     LANGUAGE (unset)
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
     PATH=/Users/blgl/bin:/Users/blgl/bin/powerpc-apple-darwin:/usr/ 
local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/arla/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