Skip Menu |
 

This queue is for tickets about the Expect CPAN distribution.

Report information
The Basics
Id: 20143
Status: resolved
Priority: 0/
Queue: Expect

People
Owner: Nobody in particular
Requestors: jwing [...] us.ibm.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.17
Fixed in: 1.18



Subject: Make test hangs
Download (untitled) / with headers
text/plain 2.4k
make test PERL_DL_NONLAZY=1 /usr/local/5.8.5/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl 1..36 Basic tests... Does not return. If I turn on the debugs in test.pl, it progresses to the exp_continue and then hangs again. /usr/local/5.8.5/bin/perl -V Summary of my perl5 (revision 5 version 8 subversion 5) configuration: Platform: osname=aix, osvers=5.3.0.0, archname=aix-thread-multi uname='aix at1004g 3 5 00cd8e3f4c00 ' config_args='' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=undef usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc_r', ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -I/usr/local/include', optimize='-O', cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -I/usr/local/include' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=8, prototype=define Linker and Libraries: ld='ld', ldflags =' -brtl -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib libs=-lbind -lnsl -lgdbm -ldbm -ldb -ldl -lld -lm -lcrypt -lpthreads -lc -lbsd perllibs=-lbind -lnsl -ldl -lld -lm -lcrypt -lpthreads -lc -lbsd libc=/lib/libc.a, so=a, useshrplib=true, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -bE:/usr/local/5.8.5/lib/perl5/5.8.5/aix-thread-multi/CORE/perl.exp' cccdlflags=' ', lddlflags='-bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -bnoentry -lpthreads -lc -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS PERL_IMPLICIT_CONTEXT Built under aix Compiled at Mar 23 2006 18:40:14 @INC: /usr/local/5.8.5/lib/perl5/5.8.5/aix-thread-multi /usr/local/5.8.5/lib/perl5/5.8.5 /usr/local/5.8.5/lib/perl5/site_perl/5.8.5/aix-thread-multi /usr/local/5.8.5/lib/perl5/site_perl/5.8.5 /usr/local/5.8.5/lib/perl5/site_perl IO::Tty 1.0.5 built/installed
From: RGiersig [...] cpan.org
Download (untitled) / with headers
text/plain 512b
On Tue Jun 27 13:49:18 2006, guest wrote: Show quoted text
> make test > PERL_DL_NONLAZY=1 /usr/local/5.8.5/bin/perl "-Iblib/lib" > "-Iblib/arch" test.pl > 1..36 > > Basic tests... > > Does not return. If I turn on the debugs in test.pl, it progresses to > the exp_continue and then hangs again.
I was not able to reproduce this consistently on AIX 5.3. Performing "make test" several times I got one hang, so there seems to be a race condition somewhere. I'll take a look at it. Regards, Roland -- RGiersig@cpan.org
Subject: Re: [rt.cpan.org #20143] Make test hangs
Date: Wed, 28 Jun 2006 09:56:14 -0500
To: bug-Expect [...] rt.cpan.org
From: John Wingenbach <jwing [...] us.ibm.com>
Download graycol.gif
image/gif 105b
graycol.gif
Download pic26216.gif
image/gif 1.2k
pic26216.gif
Download ecblank.gif
image/gif 45b
ecblank.gif
Download (untitled) / with headers
text/plain 1.8k
That's great. If I can be of any help please let me know. -- John Wingenbach IBM Special Events Systems Administrator Cell: 919-741-0468 Pager: john.wingenbach@events.ihost.com "Roland Giersig via RT" <bug-Expect@rt.cp To an.org> John Wingenbach/Raleigh/IBM@IBMUS cc 06/28/2006 08:36 AM Subject [rt.cpan.org #20143] Make test hangs Please respond to bug-Expect@rt.cpa n.org <URL: http://rt.cpan.org/Ticket/Display.html?id=20143 > On Tue Jun 27 13:49:18 2006, guest wrote: Show quoted text
> make test > PERL_DL_NONLAZY=1 /usr/local/5.8.5/bin/perl "-Iblib/lib" > "-Iblib/arch" test.pl > 1..36 > > Basic tests... > > Does not return. If I turn on the debugs in test.pl, it progresses to > the exp_continue and then hangs again.
I was not able to reproduce this consistently on AIX 5.3. Performing "make test" several times I got one hang, so there seems to be a race condition somewhere. I'll take a look at it. Regards, Roland -- RGiersig@cpan.org
From: michael.d.schwarz [...] spiritaero.com
On Wed Jun 28 09:36:24 2006, RGIERSIG wrote: Show quoted text
> On Tue Jun 27 13:49:18 2006, guest wrote:
> > make test > > PERL_DL_NONLAZY=1 /usr/local/5.8.5/bin/perl "-Iblib/lib" > > "-Iblib/arch" test.pl > > 1..36 > > > > Basic tests... > > > > Does not return. If I turn on the debugs in test.pl, it progresses to > > the exp_continue and then hangs again.
> > I was not able to reproduce this consistently on AIX 5.3. Performing > "make test" several times I got one hang, so there seems to be a race > condition somewhere. I'll take a look at it. > > Regards, Roland > -- > RGiersig@cpan.org
I got the same errors and traced it down to the spawn function. After the fork, if the child exec's the command ('perl -V') and the command finishes before the parent calls 'close_slave()' it will hang - at least on AIX. A quick test is to put a sleep(1) in the child part of the code before the exec and it will consistently work. Attached is a patch to use a pipe to make the child wait for the parent to close_slave before the exec call. There may be a better way, but this works.
*** Expect.pm Mon May 29 07:39:16 2006 --- blib/lib/Expect.pm Mon Jul 10 17:20:28 2006 *************** *** 103,108 **** --- 103,109 ---- # set up pipe to detect childs exec error pipe(STAT_RDR, STAT_WTR) or die "Cannot open pipe: $!"; + pipe(FROM_PARENT, TO_CHILD) or die "Cannot open pipe: $!"; STAT_WTR->autoflush(1); eval { fcntl(STAT_WTR, F_SETFD, FD_CLOEXEC); *************** *** 120,127 **** --- 121,131 ---- my $errno; ${*$self}{exp_Pid} = $pid; close STAT_WTR; + close FROM_PARENT; $self->close_slave(); $self->set_raw() if $self->raw_pty and isatty($self); + print TO_CHILD "go\n"; + close TO_CHILD; # now wait for child exec (eof due to close-on-exit) or exec error my $errstatus = sysread(STAT_RDR, $errno, 256); *************** *** 136,141 **** --- 140,146 ---- else { # child close STAT_RDR; + close TO_CHILD; $self->make_slave_controlling_terminal(); my $slv = $self->slave() *************** *** 152,157 **** --- 157,167 ---- close(STDERR); open(STDERR,">&". $slv->fileno()) or die "Couldn't reopen STDERR for writing, $!\n"; + + my $semaphore; + my $errstatus = sysread(FROM_PARENT, $semaphore, 256); + die "Cannot sync with parent: $!" if not defined $errstatus; + close FROM_PARENT; { exec(@cmd) }; print STAT_WTR $!+0;


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.