[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[ID 20000124.004] "perl in malloc(): warning: recursive call" on array write + signals



This is a bug report for perl from larse@ISI.EDU,
generated with the help of perlbug 1.26 running under perl 5.00503.


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

Running the following test script causes perl to crash. You may need
to run the script several times before seeing the problem. (The script
spawns a child process that does nothing but write to an array. The
parent signals the child periodically.)

#!/usr/local/bin/perl -w

use strict;

use constant CHUNK_SIZE => 128;
use constant ARRAY_SIZE => 1_000_000;

$| = 1;

if(my $pid = fork) {
  # parent signals periodically
  while(1) {
    select undef, undef, undef, 0.1;
    kill(ALRM => $pid) == 1 or die "cannot signal: $!";
    print ".";
  }
} else {
  # is kid up?
  unless(defined $pid) { die "cannot fork: $!"; }
  
  # initialize array (by using last element)
  my @data;
  $data[ARRAY_SIZE] = 1;
  
  # state of the process (number of alarms received)
  my $state = 0;
  $SIG{ALRM} = sub { $state++ };
  
  # run the test
  while(1) {
    # calculate new position for this iteration
    my $pos = int rand ARRAY_SIZE;
    
    # write a chunk to a random position
    @data[$pos..$pos+CHUNK_SIZE] = (1) x CHUNK_SIZE; 
  }
}


Execution of this script results in the following output:

[sub: ~/thesis/bin] short
......................perl in malloc(): warning: recursive call.
Out of memory!
....perl in malloc(): warning: recursive call.
Out of memory!
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl in free(): warning: recursive call.
perl.perl in malloc(): warning: recursive call.
Out of memory!
perl in free(): warning: recursive call.
cannot signal: No such process at short line 14.
Exit 3

Please let me know if I can provide any other information to help
track this bug down.


[Please do not change anything below this line]
-----------------------------------------------------------------

---
Site configuration information for perl 5.00503:

Configured by markm at $Date: 1999/05/05 19:42:40 $.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=freebsd, osvers=4.0-current, archname=i386-freebsd
    uname='freebsd freefall.freebsd.org 4.0-current freebsd 4.0-current #0: $Date: 1999/05/05 19:42:40 $'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='undef', gccversion=egcs-2.91.66 19990314 (egcs-1.1.2 release)
    cppflags=''
    ccflags =''
    stdchar='char', d_stdstdio=undef, usevfork=true
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags ='-Wl,-E'
    libpth=/usr/lib
    libs=-lm -lc -lcrypt
    libc=/usr/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so.3
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-DPIC -fpic', lddlflags='-shared'

Locally applied patches:
    

---
@INC for perl 5.00503:
    /usr/libdata/perl/5.00503/mach
    /usr/libdata/perl/5.00503
    /usr/local/lib/perl5/site_perl/5.005/i386-freebsd
    /usr/local/lib/perl5/site_perl/5.005
    .

---
Environment for perl 5.00503:
    HOME=/nfs/ruby/larse
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=.:/home/d7unsupp/FreeBSD.ELF/bin:/usr/local/v6/bin:/usr/local/v6/sbin:/usr/inet6/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin:/usr/tmp/scotty/bin:/stand
    PERL_BADLANG (unset)
    SHELL=/bin/ntcsh


Follow-Ups from:
Ilya Zakharevich <ilya@math.ohio-state.edu>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]