Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.93k stars 552 forks source link

threaded regex problem in _57 #169

Closed p5pRT closed 22 years ago

p5pRT commented 25 years ago

Migrated from rt.perl.org#974 (status was 'resolved')

Searchable as RT974$

p5pRT commented 25 years ago

From bl@incyte.com

The following script reaches the 'ERROR' part on a multi-processor box. It doesn't fail on a uni-proc box.

#!/opt/perl5.005_57/bin/perl

use Thread;

my $msg = 'aaa'; my @​thrds; my $cnt=100; foreach my $n ( 0..$cnt ) {   $thrds[$n] = new Thread \&loop\, $msg; } foreach $thrd ( @​thrds ) {   $thrd->join; }

sub loop {   my $string = shift;   while ( 1 )   {   my ( $i ) = ( $string =~ /^.(.).$/ );   unless ( $i )   {   print "ERROR​: string​: '$string'\t\ti​: '$i'.\n";   kill 9 => $$;   }   } }

It usually takes less than a second to die. Looks like $1..$9 aren't sufficiently protected between threads.

Tested under IRIX and Solaris.

bl

Perl Info ``` Site configuration information for perl 5.00557: Configured by bl at Wed Jul 7 15:23:53 PDT 1999. Summary of my perl5 (revision 5.0 version 5 subversion 57) configuration: Platform: osname=irix, osvers=6.5, archname=IP30-irix-thread uname='irix64 blah 6.5 04151556 ip30 mips ' config_args='-Dprefix=/opt/perl5.005_57 -Dusethreads -Doptimize=-g' hint=recommended, useposix=true, d_sigaction=define usethreads=define useperlio=undef d_sfio=undef use64bits=undef usemultiplicity=undef Compiler: cc='cc -n32', optimize='-g', gccversion= cppflags='-D_BSD_TYPES -D_BSD_TIME -OPT:Olimit=0:space=ON -DDEBUGGING -I/usr/local/include -I/usr/gnu/include -DLANGUAGE_C' ccflags ='-D_BSD_TYPES -D_BSD_TIME -woff 1009,1110,1184 -OPT:Olimit=0:space=ON -DDEBUGGING -I/usr/local/include -I/usr/gnu/include -DLANGUAGE_C' stdchar='unsigned char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 alignbytes=8, usemymalloc=n, prototype=define Linker and Libraries: ld='cc -n32', ldflags =' -L/usr/local/lib32 -L/usr/local/lib -L/usr/gnu/lib' libpth=/usr/local/lib /usr/gnu/lib /usr/lib32 /lib32 /lib /usr/lib libs=-ldb -lm -lrt -lpthread libc=/usr/lib32/libc.so, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-n32 -shared -L/usr/local/lib32 -L/usr/local/lib -L/usr/gnu/lib' Locally applied patches: @INC for perl 5.00557: /opt/perl5.005_57/lib/5.00557/IP30-irix-thread /opt/perl5.005_57/lib/5.00557 /opt/perl5.005_57/lib/site_perl/5.00557/IP30-irix-thread /opt/perl5.005_57/lib/site_perl/5.00557 . Environment for perl 5.00557: HOME=/u/cuss/bl LANG= LANGUAGE (unset) LD_LIBRARY_PATH=/usr/X11/xview:/usr/local/lib:/usr/freeware/lib:/usr/sgitcl/lib:/u/cuss/bl/lib/sgi LOGDIR (unset) PATH=/usr/cdr/bin/SGI:/u/cuss/bl/bin:/u/cuss/bl/bin/irix:/usr/local/bin:/opt/MIPSpro/bin:/usr/freeware/bin:/usr/Cadmin/bin:/usr/Motif-1.2/bin:/usr/Motif-2.1/bin:/usr/OnRamp/bin:/usr/SGImeeting/bin:/usr/ToolTalk/bin:/usr/WebFace/bin:/usr/demos/bin:/usr/diags/bin:/usr/gnu/bin:/usr/java/bin:/usr/pcp/bin:/usr/pkg/bin:/usr/sgitcl/bin:/usr/ssm/bin:/usr/sysadm/bin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bsd:/bin/X11:/usr/etc:/etc:/usr/lib PERL_BADLANG (unset) SHELL=/bin/tcsh ```
p5pRT commented 24 years ago

From [Unknown Contact. See original ticket]

Hi\,

in my search for 'the bug' in our code\, I stumbled upon the "real" problem ... which was identified as bug 19990707.008. as far as I can see this problem doesn't seem to be fixed. can anyone tell me wrong ? or what's the status on this one ?

the original msg : http​://bugs.perl.org/perlbug.cgi?req=tidmids&tidmids=19990707.008&range=32405&format=h

a proposed solution : http​://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/1999-11/msg00809.html

Christophe VG

p5pRT commented 24 years ago

From @gsar

On Mon\, 03 Jul 2000 18​:08​:48 +0200\, Christophe VG wrote​: [about the match-variables-aren't-thread-safe issue]

in my search for 'the bug' in our code\, I stumbled upon the "real" problem ... which was identified as bug 19990707.008. as far as I can see this problem doesn't seem to be fixed. can anyone tell me wrong ? or what's the status on this one ?

Harry Wolfson \HarryWolfson@​ll\.mit\.edu worked on an implementation\, but had to give up on it for lack of time. IIRC\, his partial implementation still had problems with the rather seriously broken implementation of (?{}) and (??{}) (which uses a fake PL_curpad without ensuring that it is a proper clone of the real pad).

Please talk to Harry to find out more if you're interested in working on this.

Sarathy gsar@​ActiveState.com

p5pRT commented 22 years ago

@gbarr - Status changed from 'open' to 'resolved'

p5pRT commented 22 years ago

From @gbarr

Bug was with 5.005 threads which are no longer supported