Segfault when trying to run PHPUnit's test suite (4.6 branch)
Version Information
$ hhvm --version
HipHop VM 3.7.0 (rel)
Compiler: 1432365749_210873458
Repo schema: de2ad6572c3e61a7c559656fe50ddb42d096626d
$ yum info hhvm
Loaded plugins: auto-update-debuginfo, fastestmirror, langpacks, remove-with-leaves
Loading mirror speeds from cached hostfile
* fedora: ftp.cc.uoc.gr
* fedora-debuginfo: fedora.uib.no
* remi: rpms.remirepo.net
* rpmfusion-free: mirror.nl.leaseweb.net
* rpmfusion-free-debuginfo: mirror.nl.leaseweb.net
* rpmfusion-free-updates: mirror.nl.leaseweb.net
* rpmfusion-free-updates-debuginfo: mirror.nl.leaseweb.net
* rpmfusion-nonfree: mirror.nl.leaseweb.net
* rpmfusion-nonfree-debuginfo: mirror.nl.leaseweb.net
* rpmfusion-nonfree-updates: mirror.nl.leaseweb.net
* rpmfusion-nonfree-updates-debuginfo: mirror.nl.leaseweb.net
* updates: ftp.pbone.net
* updates-debuginfo: ftp.pbone.net
Installed Packages
Name : hhvm
Arch : x86_64
Version : 3.7.0
Release : 1.fc21
Size : 71 M
Repo : installed
From repo : jrobeson-hhvm
Summary : HipHop VM (HHVM) is a virtual machine for executing programs written in PHP
URL : http://hhvm.com
License : PHP and Zend and BSD and MIT and and ASL 2.0 and LGPLv2 with exceptions
Description : HipHop VM (HHVM) is a new open-source virtual machine designed for executing
: programs written in PHP.
: HHVM uses a just-in-time compilation approach to achieve superior performance
: while maintaining the flexibility that PHP developers are accustomed to.
Trying to run PHPUnit's testsuite with HHVM
$ hhvm phpunit
[1] 25078 segmentation fault (core dumped) hhvm phpunit
Trying to run PHPUnit's testsuite with HHVM (through GDB (without debug symbols for HHVM))
$ gdb hhvm
GNU gdb (GDB) Fedora 7.8.2-38.fc21
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hhvm...(no debugging symbols found)...done.
Missing separate debuginfos, use: debuginfo-install hhvm-3.7.0-1.fc21.x86_64
(gdb) r phpunit
Starting program: /usr/bin/hhvm phpunit
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Detaching after fork from child process 25154.
Detaching after fork from child process 25155.
PHPUnit 4.6.9 by Sebastian Bergmann and contributors.
Configuration read from /usr/local/src/phpunit/phpunit.xml
............................................................. 61 / 1330 ( 4%)
............................................................. 122 / 1330 ( 9%)
............................................................. 183 / 1330 ( 13%)
............................................................. 244 / 1330 ( 18%)
............................................................. 305 / 1330 ( 22%)
............................................................. 366 / 1330 ( 27%)
............................................................. 427 / 1330 ( 32%)
............................................................. 488 / 1330 ( 36%)
............................................................. 549 / 1330 ( 41%)
............................................................. 610 / 1330 ( 45%)
................................Detaching after fork from child process 25157.
S............................ 671 / 1330 ( 50%)
............................................................. 732 / 1330 ( 55%)
............................................................. 793 / 1330 ( 59%)
................................ESDetaching after fork from child process 25158.
........................... 854 / 1330 ( 64%)
..............
Program received signal SIGSEGV, Segmentation fault.
0x00000000013a956a in HPHP::jit::FixupMap::fixupWork(HPHP::ExecutionContext*, HPHP::ActRec*) const ()
(gdb) bt
#0 0x00000000013a956a in HPHP::jit::FixupMap::fixupWork(HPHP::ExecutionContext*, HPHP::ActRec*) const ()
#1 0x0000000002b260bb in HPHP::jit::MCGenerator::syncWork() ()
#2 0x0000000000d33de1 in HPHP::ExecutionContext::handleError(std::string const&, int, bool, HPHP::ExecutionContext::ErrorThrowMode, std::string const&, bool) ()
#3 0x0000000002b7c777 in HPHP::raise_warning(char const*, ...) ()
#4 0x0000000001ab6df5 in HPHP::libxml_ext_entity_loader(char const*, char const*, _xmlParserCtxt*) ()
#5 0x00007ffff3f76478 in xmlXIncludeDoProcess () from /lib64/libxml2.so.2
#6 0x00007ffff3f77b96 in xmlXIncludeProcessTreeFlagsData () from /lib64/libxml2.so.2
#7 0x00000000019def90 in HPHP::c_DOMDocument_ni_xinclude(HPHP::ObjectData*, long) ()
#8 0x0000000002b5ac2e in void HPHP::Native::callFunc<false, false>(HPHP::Func const*, void*, HPHP::TypedValue*, HPHP::TypedValue&) ()
#9 0x0000000001168531 in HPHP::TypedValue* HPHP::Native::methodWrapper<false, false>(HPHP::ActRec*) ()
#10 0x000000000780538f in ?? ()
#11 0x0000000002b1a566 in enterTCHelper ()
#12 0x000000000135b176 in HPHP::jit::x64::(anonymous namespace)::BackEnd::enterTCHelper(unsigned char*, HPHP::ActRec*) ()
#13 0x00000000015057bf in HPHP::jit::MCGenerator::enterTC(unsigned char*, HPHP::ActRec*) ()
#14 0x000000000100f071 in HPHP::enterVM(HPHP::ActRec*, HPHP::StackArgsState, HPHP::Resumable*, HPHP::ObjectData*) ()
#15 0x0000000002b19c8f in HPHP::ExecutionContext::invokeFunc(HPHP::TypedValue*, HPHP::Func const*, HPHP::Variant const&, HPHP::ObjectData*, HPHP::Class*, HPHP::VarEnv*, HPHP::StringData*, HPHP::ExecutionContext::InvokeFlags) ()
#16 0x0000000000bc9bc5 in HPHP::ObjectData::o_invoke(HPHP::String const&, HPHP::Variant const&, bool) ()
#17 0x00000000019b1af1 in HPHP::f_hphp_invoke_method(HPHP::Variant const&, HPHP::String const&, HPHP::String const&, HPHP::Variant const&) ()
#18 0x0000000003c29594 in ?? ()
#19 0x00000000039b96b0 in ?? ()
#20 0x00007fffd98292b0 in ?? ()
#21 0x00007fffd7c28080 in ?? ()
#22 0x0000000003c29319 in ?? ()
#23 0x00007fffd7c28080 in ?? ()
#24 0x0000000003c27f88 in ?? ()
#25 0x00007fffe6e2a9b0 in ?? ()
#26 0x0000000003c242bc in ?? ()
#27 0x0000000002b1a566 in enterTCHelper ()
#28 0x000000000135b176 in HPHP::jit::x64::(anonymous namespace)::BackEnd::enterTCHelper(unsigned char*, HPHP::ActRec*) ()
#29 0x00000000015057bf in HPHP::jit::MCGenerator::enterTC(unsigned char*, HPHP::ActRec*) ()
#30 0x000000000100ef29 in HPHP::enterVM(HPHP::ActRec*, HPHP::StackArgsState, HPHP::Resumable*, HPHP::ObjectData*) ()
#31 0x0000000002b19c8f in HPHP::ExecutionContext::invokeFunc(HPHP::TypedValue*, HPHP::Func const*, HPHP::Variant const&, HPHP::ObjectData*, HPHP::Class*, HPHP::VarEnv*, HPHP::StringData*, HPHP::ExecutionContext::InvokeFlags) ()
#32 0x0000000002b6e16d in HPHP::ExecutionContext::invokeUnit(HPHP::TypedValue*, HPHP::Unit const*) ()
#33 0x0000000002b6dfd7 in HPHP::invoke_file(HPHP::String const&, bool, char const*) ()
#34 0x0000000000d03c38 in HPHP::include_impl_invoke(HPHP::String const&, bool, char const*) ()
#35 0x0000000000c495a2 in HPHP::hphp_invoke(HPHP::ExecutionContext*, std::string const&, bool, HPHP::Array const&, HPHP::VRefParamValue const&, std::string const&, std::string const&, bool&, std::string&, bool, bool, bool) ()
#36 0x0000000000c49e2e in HPHP::hphp_invoke_simple(std::string const&, bool) ()
#37 0x0000000000c61806 in HPHP::execute_program_impl(int, char**) ()
#38 0x0000000000c625de in HPHP::execute_program(int, char**) ()
#39 0x0000000000b715ef in main ()
(gdb) quit
A debugging session is active.
Inferior 1 [process 25150] will be killed.
Quit anyway? (y or n) y
Trying to run PHPUnit's testsuite with HHVM (through GDB (with debug symbols for HHVM))
$ gdb hhvm
GNU gdb (GDB) Fedora 7.8.2-38.fc21
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hhvm...Reading symbols from /usr/lib/debug/usr/bin/hhvm.debug...done.
[1] 25784 segmentation fault (core dumped) gdb hhvm
CC @paulbiss
Just for the sake of completeness:
$ gdb gdb
GNU gdb (GDB) Fedora 7.8.2-38.fc21
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from gdb...Reading symbols from /usr/lib/debug/usr/bin/gdb.debug...done.
done.
(gdb) r hhvm
Starting program: /usr/bin/gdb hhvm
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Detaching after fork from child process 28763.
GNU gdb (GDB) Fedora 7.8.2-38.fc21
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from hhvm...Reading symbols from /usr/lib/debug/usr/bin/hhvm.debug...done.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5821eff in _int_malloc (av=av@entry=0x7ffff5b58cc0 <main_arena>, bytes=bytes@entry=1024) at malloc.c:3701
3701 unlink (av, victim, bck, fwd);
(gdb) bt
#0 0x00007ffff5821eff in _int_malloc (av=av@entry=0x7ffff5b58cc0 <main_arena>, bytes=bytes@entry=1024) at malloc.c:3701
#1 0x00007ffff5825935 in __libc_calloc (n=<optimized out>, elem_size=<optimized out>) at malloc.c:3214
#2 0x0000000000708411 in xcalloc (number=number@entry=1, size=size@entry=1024) at ../../gdb/common/common-utils.c:91
#3 0x000000000070844d in xzalloc (size=size@entry=1024) at ../../gdb/common/common-utils.c:101
#4 0x000000000063053c in arch_flags_type (gdbarch=gdbarch@entry=0x1056040, name=<optimized out>, length=<optimized out>) at ../../gdb/gdbtypes.c:4450
#5 0x00000000006f83a8 in tdesc_gdb_type (gdbarch=gdbarch@entry=0x1056040, tdesc_type=0xdd4060) at ../../gdb/target-descriptions.c:767
#6 0x00000000006f8579 in tdesc_register_type (gdbarch=0x1056040, regno=56) at ../../gdb/target-descriptions.c:978
#7 0x00000000005b2892 in init_regcache_descr (gdbarch=0x1056040) at ../../gdb/regcache.c:104
#8 0x00000000006271c4 in gdbarch_data (gdbarch=gdbarch@entry=0x1056040, data=0xed0060) at ../../gdb/gdbarch.c:4519
#9 0x00000000005b2afc in regcache_descr (gdbarch=0x1056040) at ../../gdb/regcache.c:152
#10 register_size (gdbarch=gdbarch@entry=0x1056040, regnum=regnum@entry=0) at ../../gdb/regcache.c:173
#11 0x0000000000510989 in map_regcache_remote_table (gdbarch=gdbarch@entry=0x1056040, regs=0x2bcc910) at ../../gdb/remote.c:602
#12 0x00000000005116f1 in init_remote_state (gdbarch=0x1056040) at ../../gdb/remote.c:681
#13 0x00000000006271c4 in gdbarch_data (gdbarch=0x1056040, data=0xec37c0) at ../../gdb/gdbarch.c:4519
#14 0x0000000000510d09 in get_remote_arch_state () at ../../gdb/remote.c:560
#15 0x0000000000517749 in get_remote_state () at ../../gdb/remote.c:573
#16 remote_new_objfile (objfile=<optimized out>) at ../../gdb/remote.c:11660
#17 0x000000000064d0cd in generic_observer_notify (args=0x7fffffffd8c0, subject=<optimized out>) at ../../gdb/observer.c:167
#18 observer_notify_new_objfile (objfile=objfile@entry=0x0) at ./observer.inc:582
#19 0x00000000005e9da8 in clear_symtab_users (add_flags=add_flags@entry=6) at ../../gdb/symfile.c:3001
#20 0x00000000005e9e12 in new_symfile_objfile (objfile=objfile@entry=0x2a3fe10, add_flags=add_flags@entry=6) at ../../gdb/symfile.c:1116
#21 0x00000000005ea012 in symbol_file_add_with_addrs (abfd=abfd@entry=0x10deca0, name=name@entry=0x2328640 "/usr/lib/debug/usr/bin/hhvm.debug", add_flags=add_flags@entry=6,
addrs=addrs@entry=0x2b9a0e0, flags=<optimized out>, parent=parent@entry=0x100e8e0) at ../../gdb/symfile.c:1240
#22 0x00000000005ea3bd in symbol_file_add_separate (bfd=bfd@entry=0x10deca0, name=name@entry=0x2328640 "/usr/lib/debug/usr/bin/hhvm.debug", symfile_flags=symfile_flags@entry=6,
objfile=objfile@entry=0x100e8e0) at ../../gdb/symfile.c:1265
#23 0x0000000000574243 in elf_symfile_read (objfile=<optimized out>, symfile_flags=<optimized out>) at ../../gdb/elfread.c:1352
#24 0x00000000005ea3f9 in read_symbols (objfile=objfile@entry=0x100e8e0, add_flags=add_flags@entry=6) at ../../gdb/symfile.c:878
#25 0x00000000005e9fc8 in syms_from_objfile_1 (add_flags=6, addrs=0xffd150, objfile=0x100e8e0) at ../../gdb/symfile.c:1081
#26 syms_from_objfile (add_flags=6, addrs=0x100e8e0, objfile=0x100e8e0) at ../../gdb/symfile.c:1097
#27 symbol_file_add_with_addrs (abfd=abfd@entry=0x10321d0, name=name@entry=0x7fffffffe1a7 "hhvm", add_flags=add_flags@entry=6, addrs=addrs@entry=0x0, flags=flags@entry=0,
parent=parent@entry=0x0) at ../../gdb/symfile.c:1194
#28 0x00000000005ea4e4 in symbol_file_add_from_bfd (parent=0x0, flags=0, addrs=0x0, add_flags=6, name=0x7fffffffe1a7 "hhvm", abfd=0x10321d0) at ../../gdb/symfile.c:1283
#29 symbol_file_add (name=name@entry=0x7fffffffe1a7 "hhvm", add_flags=6, addrs=addrs@entry=0x0, flags=flags@entry=0) at ../../gdb/symfile.c:1298
#30 0x00000000005ea548 in symbol_file_add_main_1 (args=0x7fffffffe1a7 "hhvm", from_tty=1, flags=0) at ../../gdb/symfile.c:1323
#31 0x000000000061407f in catch_command_errors_const (command=0x5ea570 <symbol_file_add_main>, arg=arg@entry=0x7fffffffe1a7 "hhvm", from_tty=1, mask=RETURN_MASK_ALL)
at ../../gdb/main.c:379
#32 0x0000000000615052 in captured_main (data=data@entry=0x7fffffffdd00) at ../../gdb/main.c:1138
#33 0x0000000000610d3a in catch_errors (func=func@entry=0x6142d0 <captured_main>, func_args=func_args@entry=0x7fffffffdd00, errstring=errstring@entry=0x84e04c "",
mask=mask@entry=RETURN_MASK_ALL) at ../../gdb/exceptions.c:506
#34 0x000000000061568b in gdb_main (args=args@entry=0x7fffffffdd00) at ../../gdb/main.c:1266
#35 0x00000000004604a5 in main (argc=<optimized out>, argv=<optimized out>) at ../../gdb/gdb.c:33
A segfault of GDB should be off-topic here, though.
Can you try with 3.7.1 (just released 2 days ago)? There was a fix for a crash in DOMDocument that was merged into 3.7.1 (5763219da7e0dde4c6db7685849a83185f3f6d53).
There does not seem to be a Fedora 21 build of HHVM 3.7.1 yet: https://copr.fedoraproject.org/coprs/jrobeson/hhvm/builds/
I was able to repro on ubuntu trusty, with both 3.7.0 and 3.7.1, so that's not it. @paulbiss this looks DOMDocument/XML related, anything jump out at you?
I think DOMDocument::xinclude is missing a VMRegAnchor (anything that can raise an error, warning, or notice needs one). I'll try to get a repro but it should be a one line fix.
FYI: I do not have a Fedora 21 system anymore (upgraded all my systems to Fedora 22 this week).
Hi @sebastianbergmann ,
I submitted a pull request to fix the segfault. @paulbiss 's suggestion worked. The core problem was that by default the "file" protocol is not enabled for importing an XML entity such as via xinclude. Please add -d hhvm.libxml.ext_entity_whitelist=file to the hhvm command-line to resolve this. See the libxml_ext_entity_loader function in ext_libxml.cpp for more info.
I also noticed that Framework_AssertTest::testXMLStructureIsSame needs the same "skipif" as tests/Regression/GitHub/1472.phpt: "HHVM does not support cloning DOM nodes"
Lastly, I also noticed that Framework_TestCaseTest::testStaticAttributesBackupPre is failing due to
"Attempted to serialize unserializable builtin class DOMDocument". I haven't figured this one out yet.
As an aside, to use gdb with hhvm, preface it with LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so. This will avoid the segfault in gdb that you mentioned.