Front page | perl.perl5.porters |
Postings from July 2014
[perl #122199] perl5.18 segfault after wait() when system don't have much free memory
Thread Next
From:
Victor Efimov
Date:
July 1, 2014 05:23
Subject:
[perl #122199] perl5.18 segfault after wait() when system don't have much free memory
Message ID:
rt-4.0.18-3976-1404152620-1563.122199-75-0@perl.org
# New Ticket Created by Victor Efimov
# Please include the string: [perl #122199]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=122199 >
The following code segfaults under FreeBSD 10
When I tried to reduce original script to this PoC I had lot of
different error messages instead of segfault:
1) Can't locate object method "Dump" via package "Data::Dumper"
(perhaps you forgot to load "Data::Dumper"?) at
/usr/local/lib/perl5/5.16/mach/Data/Dumper.pm line 588.
2) Attempt to free unreferenced scalar: SV 0x801d18ea0, Perl
interpreter: 0x801c19c00 at 4.pl line 55.
3) Attempt to free nonexistent shared string 'usevendorprefix', Perl
interpreter: 0x801c19c00 during global destruction.
4) Not a CODE reference at ./gemu-test-worker.pl line 1311, <STDIN> line
5) END failed--call queue aborted at ./gemu-test-worker.pl line 1311, <STDIN>
6) Core dump stack: ...
7) or evidences of data corruption like %INC entries replaced with empty strings
===
$ perl 4.pl
Segmentation fault (core dumped)
$ cat 4.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
unless (fork()) {
my $sz = 2048*1024*1024;
my $sc = "x" x $sz;
exit(0);
}
wait();
print Dumper { a => 42};
exit();
===
(NOTE that $sz should be adjusted to take almost all free memory, in
my case 2048*1024*1024 for 4Gb virtual machine)
Seems parent proccess segfaults, while child process take huge amount
of memory. So parent do almost nothing and segfault after wait().
Purpose of allocating memory in child is to create a "load" for system.
Note that there were no messages in syslog (like oom killer etc),
there were but not for each process.
dmesg output:
===
pid 1021 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1208 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1330 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(8): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(12): failed
swap_pager_getswapspace(16): failed
swap_pager_getswapspace(12): failed
pid 1375 (perl5.16.3), uid 1001, was killed: out of swap space
pid 1406 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1439 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1471 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1536 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1569 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1601 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1603 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1605 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1607 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1611 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1613 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1619 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1621 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1658 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1662 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1664 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1670 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1672 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1676 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1682 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 1688 (perl5.16.3), uid 1001: exited on signal 11 (core dumped)
pid 4342 (perl5.18.2), uid 1001: exited on signal 11 (core dumped)
pid 14661 (perl5.18.2), uid 1001: exited on signal 11 (core dumped)
===
Affected versions summary:
5.16 with Clang - bug.
5.16 with gcc - no bug.
5.18 Clang/gcc - bug
5.20 clang - no bug
(of course "no bug" means "cannot reproduce bug")
Related threads - discussing same (I hope) issue:
http://www.perlmonks.org/?node_id=1091458
https://github.com/vsespb/mt-aws-glacier/issues/81
FreeBSD version:
$ uname -a
FreeBSD BSD10 10.0-RELEASE-p6 FreeBSD 10.0-RELEASE-p6 #0: Tue Jun 24
07:47:37 UTC 2014
root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
Below perl versions in details:
Clang+5.16
===
Summary of my perl5 (revision 5 version 16 subversion 3) configuration:
Platform:
osname=freebsd, osvers=10.0-release-p6, archname=amd64-freebsd-thread-multi
uname='freebsd bsd10 10.0-release-p6 freebsd 10.0-release-p6 #0:
tue jun 24 07:47:37 utc 2014
root@amd64-builder.daemonology.net:usrobjusrsrcsysgeneric amd64 '
config_args='-sde -Dprefix=/usr/local
-Darchlib=/usr/local/lib/perl5/5.16/mach
-Dprivlib=/usr/local/lib/perl5/5.16
-Dman3dir=/usr/local/lib/perl5/5.16/perl/man/man3
-Dman1dir=/usr/local/man/man1
-Dsitearch=/usr/local/lib/perl5/site_perl/5.16/mach
-Dsitelib=/usr/local/lib/perl5/site_perl/5.16
-Dscriptdir=/usr/local/bin
-Dsiteman3dir=/usr/local/lib/perl5/5.16/man/man3
-Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv
-Uinstallusrbinperl -Dcc=cc -Duseshrplib -Dinc_version_list=none
-Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.16/BSDPAN"
-Doptimize=-O2 -pipe -fno-strict-aliasing -Ui_gdbm -Dusethreads=y
-Dusemymalloc=n -Duse64bitint'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags
='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.16/BSDPAN" -DHAS_FPSETMASK
-DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include',
optimize='-O2 -pipe -fno-strict-aliasing',
cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.16/BSDPAN"
-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.2.1 Compatible FreeBSD Clang 3.3
(tags/RELEASE_33/final 183502)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags ='-pthread -Wl,-E -fstack-protector -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lm -lcrypt -lutil
perllibs=-lm -lcrypt -lutil
libc=, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='
-Wl,-R/usr/local/lib/perl5/5.16/mach/CORE'
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib
-fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_REENTRANT_API
Built under freebsd
Compiled at Jun 29 2014 22:54:34
%ENV:
PERL_MB_OPT="--install_base "/home/vse/perl5""
PERL_MM_OPT="INSTALL_BASE=/home/vse/perl5"
@INC:
/usr/local/lib/perl5/5.16/BSDPAN
/usr/local/lib/perl5/site_perl/5.16/mach
/usr/local/lib/perl5/site_perl/5.16
/usr/local/lib/perl5/5.16/mach
/usr/local/lib/perl5/5.16
.
===
Clang + 5.18
===
Summary of my perl5 (revision 5 version 18 subversion 2) configuration:
Platform:
osname=freebsd, osvers=10.0-release-p6, archname=amd64-freebsd-thread-multi
uname='freebsd bsd10 10.0-release-p6 freebsd 10.0-release-p6 #0:
tue jun 24 07:47:37 utc 2014
root@amd64-builder.daemonology.net:usrobjusrsrcsysgeneric amd64 '
config_args='-sde -Dprefix=/usr/local
-Darchlib=/usr/local/lib/perl5/5.18/mach
-Dprivlib=/usr/local/lib/perl5/5.18
-Dman3dir=/usr/local/lib/perl5/5.18/perl/man/man3
-Dman1dir=/usr/local/man/man1
-Dsitearch=/usr/local/lib/perl5/site_perl/5.18/mach
-Dsitelib=/usr/local/lib/perl5/site_perl/5.18
-Dscriptdir=/usr/local/bin
-Dsiteman3dir=/usr/local/lib/perl5/5.18/man/man3
-Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv
-Uinstallusrbinperl -Dcc= -Duseshrplib -Dinc_version_list=none
-Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.18/BSDPAN"
-Doptimize=-O2 -pipe -fno-strict-aliasing -Ui_gdbm -Duse64bitint
-Dusethreads=y -Dusemymalloc=n'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags
='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.18/BSDPAN" -DHAS_FPSETMASK
-DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include',
optimize='-O2 -pipe -fno-strict-aliasing',
cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.18/BSDPAN"
-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.2.1 Compatible FreeBSD Clang 3.3
(tags/RELEASE_33/final 183502)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags ='-pthread -Wl,-E -fstack-protector -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lm -lcrypt -lutil
perllibs=-lm -lcrypt -lutil
libc=, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='
-Wl,-R/usr/local/lib/perl5/5.18/mach/CORE'
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib
-fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_REENTRANT_API
Built under freebsd
Compiled at Jul 1 2014 02:01:05
%ENV:
PERL_MB_OPT="--install_base "/home/vse/perl5""
PERL_MM_OPT="INSTALL_BASE=/home/vse/perl5"
@INC:
/usr/local/lib/perl5/5.18/BSDPAN
/usr/local/lib/perl5/site_perl/5.18/mach
/usr/local/lib/perl5/site_perl/5.18
/usr/local/lib/perl5/5.18/mach
/usr/local/lib/perl5/5.18
.
===
GCC + 5.18
===
Summary of my perl5 (revision 5 version 18 subversion 2) configuration:
Platform:
osname=freebsd, osvers=10.0-release-p6, archname=amd64-freebsd-thread-multi
uname='freebsd bsd10 10.0-release-p6 freebsd 10.0-release-p6 #0:
tue jun 24 07:47:37 utc 2014
root@amd64-builder.daemonology.net:usrobjusrsrcsysgeneric amd64 '
config_args='-sde -Dprefix=/usr/local
-Darchlib=/usr/local/lib/perl5/5.18/mach
-Dprivlib=/usr/local/lib/perl5/5.18
-Dman3dir=/usr/local/lib/perl5/5.18/perl/man/man3
-Dman1dir=/usr/local/man/man1
-Dsitearch=/usr/local/lib/perl5/site_perl/5.18/mach
-Dsitelib=/usr/local/lib/perl5/site_perl/5.18
-Dscriptdir=/usr/local/bin
-Dsiteman3dir=/usr/local/lib/perl5/5.18/man/man3
-Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv
-Uinstallusrbinperl -Dcc=gcc47 -Duseshrplib -Dinc_version_list=none
-Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.18/BSDPAN"
-Doptimize=-O2 -pipe -fno-strict-aliasing -Ui_gdbm -Duse64bitint
-Dusethreads=y -Dusemymalloc=n'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc47', ccflags
='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.18/BSDPAN" -DHAS_FPSETMASK
-DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector
-I/usr/local/include',
optimize='-O2 -pipe -fno-strict-aliasing',
cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.18/BSDPAN"
-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.7.3', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='gcc47', ldflags ='-pthread -Wl,-E -fstack-protector -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lm -lcrypt -lutil
perllibs=-lm -lcrypt -lutil
libc=, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='
-Wl,-R/usr/local/lib/perl5/5.18/mach/CORE'
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib
-fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_REENTRANT_API
Built under freebsd
Compiled at Jul 1 2014 02:07:57
%ENV:
PERL_MB_OPT="--install_base "/home/vse/perl5""
PERL_MM_OPT="INSTALL_BASE=/home/vse/perl5"
@INC:
/usr/local/lib/perl5/5.18/BSDPAN
/usr/local/lib/perl5/site_perl/5.18/mach
/usr/local/lib/perl5/site_perl/5.18
/usr/local/lib/perl5/5.18/mach
/usr/local/lib/perl5/5.18
.
Thread Next
-
[perl #122199] perl5.18 segfault after wait() when system don't have much free memory
by Victor Efimov