facebook / hhvm

A virtual machine for executing programs written in Hack.
https://hhvm.com
Other
18.17k stars 2.99k forks source link

HHVM stops at segmentation fault (mysql_set_charset) #8050

Closed safe-net9 closed 6 years ago

safe-net9 commented 6 years ago

I ran Wordpress on HHVM. When Wordpress accesses MySQL, HHVM stops.

At that time the following log is output.

less /tmp/stacktrace.7399.log

ProcessID: 7399 ThreadID: 140142325004032 ThreadPID: 7408 Name: unknown program Type: Segmentation fault Runtime: hhvm Version: tags/HHVM-3.23.1-0-g24b71e84d464f0cdc39b723e56a1dd7538c54019 DebuggerCount: 0

Server: news.right-wing.net ThreadType: Web Request Server_SERVER_NAME: news.right-wing.net URL: /sitemap.xml

0 0000000000d92756

1 00000000013835e3

2 00007f758f8ef5e0

3 00000000036ba547

4 0000000003033999

5 00000000036b8fb3

6 00000000036fd36a

7 00000000036fd1d1

8 00000000019ffda9

9 0000000001a0571a

10 0000000001a05abb

11 00000000018c48e9

12 00000000036855ad

13 0000000003683f77

14 00000000037a02d1

15 00000000037a0111

16 000000000379fed1

17 000000000144add4

18 000000000378e387

19 00000000037866e7

20 000000000174981f

21 000000000174a3ff

22 0000000000d47b87

23 0000000001528557

24 00007f758f8e7e25

25 00007f7588ed634d

PHP Stacktrace:

0 mysql_set_charset()

1 mysqli->set_charset()

2 mysqli_set_charset() called at [/var/home/site/news.right-wing.net/wp-content/advanced-cache.php:63]

3 SiteManagerAdvancedCache->__construct() called at [/var/home/site/news.right-wing.net/wp-content/advanced-cache.php:223]

4 include() called at [/var/home/site/news.right-wing.net/wp-settings.php:84]

5 include() called at [/var/home/site/news.right-wing.net/wp-config.php:105]

6 include() called at [/var/home/site/news.right-wing.net/wp-load.php:37]

7 include() called at [/var/home/site/news.right-wing.net/wp-blog-header.php:13]

8 include() called at [/var/home/site/news.right-wing.net/index.php:17]

It is thought that hhvm and the MySQL Client library are not linked.

ldd hhvm

    linux-vdso.so.1 =>  (0x00007ffea01f3000)
    libjemalloc.so.1 => /lib64/libjemalloc.so.1 (0x00007fb982433000)
    libyaml-0.so.2 => /lib64/libyaml-0.so.2 (0x00007fb982212000)
    libonig.so.2 => /lib64/libonig.so.2 (0x00007fb981fa9000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fb981da5000)
    libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fb981b42000)
    libicui18n.so.58 => /var/home/lib/icu/lib/libicui18n.so.58 (0x00007fb9816cd000)
    libicuuc.so.58 => /var/home/lib/icu/lib/libicuuc.so.58 (0x00007fb981325000)
    libevent-2.0.so.5 => /lib64/libevent-2.0.so.5 (0x00007fb9810dc000)
    libcurl.so.4 => /lib64/libcurl.so.4 (0x00007fb980e73000)
    libglog.so.0 => /lib64/libglog.so.0 (0x00007fb980c43000)
    libcap.so.2 => /lib64/libcap.so.2 (0x00007fb980a3d000)
    libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fb980823000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fb980607000)
    libtbb.so.2 => /lib64/libtbb.so.2 (0x00007fb9803d1000)
    libssl.so.1.0.0 => /var/home/lib/openssl/lib/libssl.so.1.0.0 (0x00007fb98015f000)
    libcrypto.so.1.0.0 => /var/home/lib/openssl/lib/libcrypto.so.1.0.0 (0x00007fb97fd0f000)
    libz.so.1 => /lib64/libz.so.1 (0x00007fb97faf8000)
    libxml2.so.2 => /lib64/libxml2.so.2 (0x00007fb97f78e000)
    liblber-2.4.so.2 => /lib64/liblber-2.4.so.2 (0x00007fb97f57f000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fb97f347000)
    librt.so.1 => /lib64/librt.so.1 (0x00007fb97f13f000)
    libsqlite3.so.0 => /lib64/libsqlite3.so.0 (0x00007fb97ee8a000)
    libdouble-conversion.so.1 => /lib64/libdouble-conversion.so.1 (0x00007fb97ec78000)
    liblz4.so.1 => /lib64/liblz4.so.1 (0x00007fb97ea65000)
    libfastlz.so.0 => /lib64/libfastlz.so.0 (0x00007fb97e862000)
    libedit.so.0 => /lib64/libedit.so.0 (0x00007fb97e624000)
    libdwarf.so.0 => /lib64/libdwarf.so.0 (0x00007fb97e3e9000)
    libelf.so.1 => /lib64/libelf.so.1 (0x00007fb97e1d1000)
    libbz2.so.1 => /lib64/libbz2.so.1 (0x00007fb97dfc0000)
    libfribidi.so.0 => /lib64/libfribidi.so.0 (0x00007fb97dda7000)
    libfreetype.so.6 => /lib64/libfreetype.so.6 (0x00007fb97db01000)
    libjpeg.so.62 => /lib64/libjpeg.so.62 (0x00007fb97d8ab000)
    libpng15.so.15 => /lib64/libpng15.so.15 (0x00007fb97d680000)
    libvpx.so.1 => /lib64/libvpx.so.1 (0x00007fb97d2f8000)
    libgmp.so.10 => /lib64/libgmp.so.10 (0x00007fb97d07f000)
    libMagickWand.so.5 => /lib64/libMagickWand.so.5 (0x00007fb97cd6a000)
    libMagickCore.so.5 => /lib64/libMagickCore.so.5 (0x00007fb97c8c1000)
    libc-client.so.2007 => /lib64/libc-client.so.2007 (0x00007fb97c5ac000)
    libldap-2.4.so.2 => /lib64/libldap-2.4.so.2 (0x00007fb97c358000)
    libmcrypt.so.4 => /var/home/lib/libmcrypt/lib/libmcrypt.so.4 (0x00007fb97c126000)
    libmemcached.so.11 => /lib64/libmemcached.so.11 (0x00007fb97bef3000)
    libodbc.so.2 => /lib64/libodbc.so.2 (0x00007fb97bc8b000)
    libexpat.so.1 => /lib64/libexpat.so.1 (0x00007fb97ba61000)
    libxslt.so.1 => /lib64/libxslt.so.1 (0x00007fb97b821000)
    libexslt.so.0 => /lib64/libexslt.so.0 (0x00007fb97b60c000)
    libnuma.so.1 => /lib64/libnuma.so.1 (0x00007fb97b400000)
    libre2.so.0 => /lib64/libre2.so.0 (0x00007fb97b195000)
    libboost_context.so.1.59.0 => /var/home/lib/boost/lib/libboost_context.so.1.59.0 (0x00007fb97af8c000)
    libboost_filesystem.so.1.59.0 => /var/home/lib/boost/lib/libboost_filesystem.so.1.59.0 (0x00007fb97ad75000)
    libboost_program_options.so.1.59.0 => /var/home/lib/boost/lib/libboost_program_options.so.1.59.0 (0x00007fb97ab02000)
    libboost_system.so.1.59.0 => /var/home/lib/boost/lib/libboost_system.so.1.59.0 (0x00007fb97a8fe000)
    libboost_thread.so.1.59.0 => /var/home/lib/boost/lib/libboost_thread.so.1.59.0 (0x00007fb97a6de000)
    libstdc++.so.6 => /var/home/lib/gcc494/lib64/libstdc++.so.6 (0x00007fb97a3d3000)
    libm.so.6 => /lib64/libm.so.6 (0x00007fb97a0d1000)
    libgcc_s.so.1 => /var/home/lib/gcc494/lib64/libgcc_s.so.1 (0x00007fb979eba000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fb979af6000)
    /lib64/ld-linux-x86-64.so.2 (0x000055b6f1d15000)
    libicudata.so.58 => /var/home/lib/icu/lib/libicudata.so.58 (0x00007fb977ff6000)
    libidn.so.11 => /lib64/libidn.so.11 (0x00007fb977dc2000)
    libssh2.so.1 => /lib64/libssh2.so.1 (0x00007fb977b98000)
    libssl3.so => /lib64/libssl3.so (0x00007fb97794c000)
    libsmime3.so => /lib64/libsmime3.so (0x00007fb977724000)
    libnss3.so => /lib64/libnss3.so (0x00007fb9773fa000)
    libnssutil3.so => /lib64/libnssutil3.so (0x00007fb9771cd000)
    libplds4.so => /lib64/libplds4.so (0x00007fb976fc8000)
    libplc4.so => /lib64/libplc4.so (0x00007fb976dc3000)
    libnspr4.so => /lib64/libnspr4.so (0x00007fb976b85000)
    libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007fb976937000)
    libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007fb97664f000)
    libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007fb97641c000)
    libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007fb976217000)
    libgflags.so.2.1 => /lib64/libgflags.so.2.1 (0x00007fb975ff6000)
    libattr.so.1 => /lib64/libattr.so.1 (0x00007fb975df0000)
    liblzma.so.5 => /lib64/liblzma.so.5 (0x00007fb975bca000)
    libfreebl3.so => /lib64/libfreebl3.so (0x00007fb9759c7000)
    libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007fb97579c000)
    libtiff.so.5 => /lib64/libtiff.so.5 (0x00007fb975528000)
    libfontconfig.so.1 => /lib64/libfontconfig.so.1 (0x00007fb9752ea000)
    libXext.so.6 => /lib64/libXext.so.6 (0x00007fb9750d8000)
    libXt.so.6 => /lib64/libXt.so.6 (0x00007fb974e71000)
    libltdl.so.7 => /lib64/libltdl.so.7 (0x00007fb974c66000)
    libSM.so.6 => /lib64/libSM.so.6 (0x00007fb974a5e000)
    libICE.so.6 => /lib64/libICE.so.6 (0x00007fb974842000)
    libX11.so.6 => /lib64/libX11.so.6 (0x00007fb974503000)
    libgomp.so.1 => /var/home/lib/gcc494/lib64/libgomp.so.1 (0x00007fb9742ec000)
    libpam.so.0 => /lib64/libpam.so.0 (0x00007fb9740dc000)
    libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007fb973c7b000)
    libssl.so.10 => /lib64/libssl.so.10 (0x00007fb973a09000)
    libsasl2.so.3 => /lib64/libsasl2.so.3 (0x00007fb9737eb000)
    libgcrypt.so.11 => /lib64/libgcrypt.so.11 (0x00007fb97356a000)
    libgpg-error.so.0 => /lib64/libgpg-error.so.0 (0x00007fb973364000)
    libboost_chrono.so.1.59.0 => /var/home/lib/boost/lib/libboost_chrono.so.1.59.0 (0x00007fb97315d000)
    libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007fb972f4e000)
    libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007fb972d4a000)
    libjbig.so.2.0 => /lib64/libjbig.so.2.0 (0x00007fb972b3d000)
    libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fb972938000)
    libxcb.so.1 => /lib64/libxcb.so.1 (0x00007fb97270f000)
    libaudit.so.1 => /lib64/libaudit.so.1 (0x00007fb9724e7000)
    libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fb9722bf000)
    libXau.so.6 => /lib64/libXau.so.6 (0x00007fb9720bb000)
    libcap-ng.so.0 => /lib64/libcap-ng.so.0 (0x00007fb971eb5000)

The options when building HHVM from source code are as follows.

env CC=gcc5 CXX=g++5 CPP=cpp5 \ cmake3 ../hhvm-3.23.1 \ -DCMAKE_INSTALL_PREFIX=/var/home/ap/hhvm \ -DCMAKE_EXE_LINKER_FLAGS='-L/var/home/lib/boost/lib -L/var/home/lib/gcc494/lib64 -L/var/home/ap/llvm/lib -L/var/home/ap/porg/lib -L/var/home/lib/openssl/lib -L/var/home/ap/mysql/lib -L/var/home/lib/icu/lib -L/var/home/lib/libmcrypt/lib' \ -DCMAKE_MODULE_LINKER_FLAGS='-L/var/home/lib/boost/lib -L/var/home/lib/gcc494/lib64 -L/var/home/ap/llvm/lib -L/var/home/ap/porg/lib -L/var/home/lib/openssl/lib -L/var/home/ap/mysql/lib -L/var/home/lib/icu/lib -L/var/home/lib/libmcrypt/lib' \ -DCMAKE_C_FLAGS='-I/var/home/ap/mysql/include -I/var/home/lib/boost/include/boost -I/var/home/lib/gcc494/include/c++/4.9.4 -I/var/home/ap/llvm/include -I/var/home/lib/icu/include -I/var/home/lib/libmcrypt/include -I/var/home/lib/openssl/include/openssl' \ -DCMAKE_CXX_FLAGS='-I/var/home/ap/mysql/include -I/var/home/lib/boost/include/boost -I/var/home/lib/gcc494/include/c++/4.9.4 -I/var/home/ap/llvm/include -I/var/home/lib/icu/include -I/var/home/lib/libmcrypt/include -I/var/home/lib/openssl/include/openssl' \ -DBOOST_INCLUDEDIR=/var/home/lib/boost/include \ -DBOOST_LIBRARYDIR=/var/home/lib/boost/lib \ -DBoost_USE_STATIC_LIBS=OFF \ -DMYSQL_INCLUDE_DIR=/var/home/ap/mysql/include \ -DMYSQL_LIB_DIR=/var/home/ap/mysql/lib \ -DMYSQL_LIB=/var/home/ap/mysql/lib/libmysqlclient.so \ -DICU_INCLUDE_DIR=/var/home/lib/icu/include \ -DICU_LIBRARY=/var/home/lib/icu/lib/libicuuc.so \ -DICU_I18N_LIBRARY=/var/home/lib/icu/lib/libicui18n.so \ -DICU_DATA_LIBRARY=/var/home/lib/icu/lib/libicudata.so \ -DOPENSSL_SSL_LIBRARY=/var/home/lib/openssl/lib/libssl.so \ -DOPENSSL_INCLUDE_DIR=/var/home/lib/openssl/include \ -DOPENSSL_CRYPTO_LIBRARY=/var/home/lib/openssl/lib/libcrypto.so

How can I link HHVM with libmysqlclient.so?

HHVM Version

3.23.1

fredemmott commented 6 years ago

It is thought that hhvm and the MySQL Client library are not linked. How can I link HHVM with libmysqlclient.so?

It's statically linked against libmysqlclient.a. It shouldn't be linked against libmysqlclient.so

Can you install the hhvm-dbg package, and get a backtrace from gdb?

safe-net9 commented 6 years ago

Thank you for your reply. The following is the output result of hhvm - gdb backtrace. Call "/var/home/src/hhvm-3.23.1/third-party/webscalesqlclient/src/sql-common/client.c" from processing, and I will notice that it is not linked to libmysqlclient.a. What should I do?

/var/home/ap/hhvm/bin/hhvm-gdb /var/home/ap/hhvm/bin/hhvm -c /tm p/core.11098 Debugging with hhvm: /var/home/ap/hhvm/bin/hhvm ... GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-100.el7 Copyright (C) 2013 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". For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/... Reading symbols from /var/home/ap/hhvm/bin/hhvm...done. [New LWP 11101] [New LWP 11100] [New LWP 11098] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Core was generated by `/var/home/ap/hhvm/bin/hhvm --config /etc/hhvm/server.ini --user nginx --mode da'. Program terminated with signal 11, Segmentation fault.

0 net_field_length (packet=packet@entry=0x7f6171bf9428)

at /var/home/src/hhvm-3.23.1/third-party/webscalesqlclient/src/sql-common/pack.c:25

25 if (*pos < 251) warning: File "/var/home/lib/gcc494/lib64/libstdc++.so.6.0.20-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load:/usr/bin/mono-gdb.py". To enable execution of this file add add-auto-load-safe-path /var/home/lib/gcc494/lib64/libstdc++.so.6.0.20-gdb.py line to your configuration file "/root/.gdbinit". To completely disable this security protection add set auto-load safe-path / line to your configuration file "/root/.gdbinit". Missing separate debuginfos, use: debuginfo-install ImageMagick-6.7.8.9-15.el7_2.x86_64 audit-libs-2.7.6-3.el7.x86_64 bzip2-libs-1.0.6-13.el7.x86_64 cyrus-sasl-lib-2.1.26-21.el7.x86_64 double-conversion-2.0.1-3.el7.x86_64 elfutils-libelf-0.168-8.el7.x86_64 expat-2.1.0-10.el7_3.x86_64 fastlz-0.1.0-0.1.20070619svnrev12.el7.x86_64 fontconfig-2.10.95-11.el7.x86_64 freetype-2.4.11-15.el7.x86_64 fribidi-0.19.4-6.el7.x86_64 gflags-2.1.1-6.el7.x86_64 glibc-2.17-196.el7.x86_64 glog-0.3.3-8.el7.x86_64 gmp-6.0.0-15.el7.x86_64 jbigkit-libs-2.0-11.el7.x86_64 jemalloc-3.6.0-1.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 krb5-libs-1.15.1-8.el7.x86_64 libICE-1.0.9-9.el7.x86_64 libSM-1.2.2-2.el7.x86_64 libX11-1.6.5-1.el7.x86_64 libXau-1.0.8-2.1.el7.x86_64 libXext-1.3.3-3.el7.x86_64 libXt-1.1.5-3.el7.x86_64 libattr-2.4.46-12.el7.x86_64 libc-client-2007f-16.el7.x86_64 libcap-2.22-9.el7.x86_64 libcap-ng-0.7.5-4.el7.x86_64 libcom_err-1.42.9-10.el7.x86_64 libcurl-7.29.0-42.el7.x86_64 libdwarf-20130207-4.el7.x86_64 libedit-3.0-12.20121213cvs.el7.x86_64 libevent-2.0.21-4.el7.x86_64 libgcrypt-1.5.3-14.el7.x86_64 libgpg-error-1.12-3.el7.x86_64 libidn-1.28-4.el7.x86_64 libjpeg-turbo-1.2.90-5.el7.x86_64 libmemcached-1.0.16-5.el7.x86_64 libpng-1.5.13-7.el7_2.x86_64 libselinux-2.5-11.el7.x86_64 libssh2-1.4.3-10.el7_2.1.x86_64 libtiff-4.0.3-27.el7_3.x86_64 libtool-ltdl-2.4.2-22.el7_3.x86_64 libuuid-2.23.2-43.el7.x86_64 libvpx-1.3.0-5.el7_0.x86_64 libxcb-1.12-1.el7.x86_64 libxml2-2.9.1-6.el7_2.3.x86_64 libxslt-1.1.28-5.el7.x86_64 libyaml-0.1.4-11.el7_0.x86_64 lz4-1.7.3-1.el7.x86_64 ncurses-libs-5.9-14.20130511.el7_4.x86_64 nspr-4.13.1-1.0.el7_3.x86_64 nss-3.28.4-15.el7_4.x86_64 nss-softokn-freebl-3.28.3-8.el7_4.x86_64 nss-util-3.28.4-3.el7.x86_64 numactl-libs-2.0.9-6.el7_2.x86_64 oniguruma-5.9.5-3.el7.x86_64 openldap-2.4.44-5.el7.x86_64 openssl-libs-1.0.2k-8.el7.x86_64 pam-1.1.8-18.el7.x86_64 pcre-8.32-17.el7.x86_64 re2-20160401-2.el7.x86_64 sqlite-3.7.17-8.el7.x86_64 sssd-client-1.15.2-50.el7_4.6.x86_64 tbb-4.1-9.20130314.el7.x86_64 unixODBC-2.3.1-11.el7.x86_64 xz-libs-5.2.2-1.el7.x86_64 zlib-1.2.7-17.el7.x86_64 ---Type to continue, or q to quit--- For more information about this security protection see the "Auto-loading safe path" section in the GDB manual. E.g., run from the shell: info "(gdb)Auto-loading safe path" Traceback (most recent call last): File "/var/home/ap/hhvm/lib64/hhvm/gdb/hhvm.py", line 24, in import stack File "/var/home/ap/hhvm/lib64/hhvm/gdb/stack.py", line 11, in import unwind File "/var/home/ap/hhvm/lib64/hhvm/gdb/unwind.py", line 8, in from gdb.unwinder import Unwinder, register_unwinder ImportError: No module named unwinder (gdb) bt

0 net_field_length (packet=packet@entry=0x7f6171bf9428)

at /var/home/src/hhvm-3.23.1/third-party/webscalesqlclient/src/sql-common/pack.c:25

1 0x0000000003033999 in read_ok_ex (mysql=mysql@entry=0x7f6184cb0800,

length=length@entry=107)
at /var/home/src/hhvm-3.23.1/third-party/webscalesqlclient/src/sql-common/client.c:723

2 0x00000000036b8fb3 in cli_read_query_result (mysql=0x7f6184cb0800)

at /var/home/src/hhvm-3.23.1/third-party/webscalesqlclient/src/sql-common/client.c:6328

3 0x00000000036fd36a in mysql_real_query (length=,

query=0x7f6171bf94d0 "SET NAMES utf8mb4", mysql=0x7f6184cb0800)
at /var/home/src/hhvm-3.23.1/third-party/webscalesqlclient/src/sql-common/client.c:6508

4 mysql_set_character_set (mysql=0x7f6184cb0800,

cs_name=0x7f617ddb35b8 "utf8mb4")
at /var/home/src/hhvm-3.23.1/third-party/webscalesqlclient/src/sql-common/client.c:7424

5 0x00000000036fd1d1 in HPHP::f_mysql_set_charset(HPHP::String const&, HPHP::Variant const&) ()

6 0x00000000019ffda9 in HPHP::Variant HPHP::Native::callFuncIndirectImpl(HPHP::TypedValue ()(HPHP::ActRec), long, int, double*, int) ()

7 0x0000000001a0571a in void HPHP::Native::callFunc(HPHP::Func const*, ---Type to continue, or q to quit---

void, HPHP::TypedValue, int, HPHP::TypedValue&) ()

8 0x0000000001a05abb in HPHP::TypedValue HPHP::Native::functionWrapper(HPHP::ActRec) ()

9 0x00000000018c48e9 in unsigned char* HPHP::dispatchImpl() ()

10 0x00000000036855ad in HPHP::enterVMAtFunc(HPHP::ActRec, HPHP::StackArgsState, HPHP::VarEnv) ()

11 0x0000000003683f77 in HPHP::ExecutionContext::invokeFunc(HPHP::Func const, HPHP::Variant const&, HPHP::ObjectData, HPHP::Class, HPHP::VarEnv, HPHP::StringData*, HPHP::ExecutionContext::InvokeFlags, bool) ()

12 0x00000000037a02d1 in HPHP::ExecutionContext::invokeUnit(HPHP::Unit const*)

()

13 0x00000000037a0111 in HPHP::invoke_file(HPHP::String const&, bool, char const*) ()

14 0x000000000379fed1 in HPHP::include_impl_invoke(HPHP::String const&, bool, char const*) ()

15 0x000000000144add4 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) ()

16 0x000000000378e387 in HPHP::HttpRequestHandler::executePHPRequest(HPHP::Transport*, HPHP::RequestURI&, HPHP::SourceRootInfo&) ()

17 0x00000000037866e7 in HPHP::HttpRequestHandler::handleRequest(HPHP::Transport*) ()

18 0x000000000174981f in HPHP::ServerWorker<std::shared_ptr, ---Type to continue, or q to quit---

HPHP::FastCGITransportTraits>::doJobImpl(std::shared_ptr, bool) ()

19 0x000000000174a3ff in HPHP::JobQueueWorker<std::shared_ptr, HPHP::Server*, true, false, HPHP::JobQueueDropVMStack>::start() ()

20 0x0000000000d47b87 in HPHP::AsyncFuncImpl::ThreadFunc(void*) ()

21 0x0000000001528557 in HPHP::start_routine_wrapper(void*) ()

22 0x00007f6193c36e25 in start_thread () from /lib64/libpthread.so.0

23 0x00007f618d22534d in clone () from /lib64/libc.so.6

fredemmott commented 6 years ago

static libraries don't show in ldd; it is linked.

Can you file this against https://github.com/facebook/mysql-5.6 please?

anoakie commented 6 years ago

I'm not the OP, but I created this issue https://github.com/facebook/mysql-5.6/issues/766

safe-net9 commented 6 years ago

Sorry for the late reply I submitted an issue to the person who was instructed.

Can you file this against https://github.com/facebook/mysql-5.6 please?

ocasta commented 6 years ago

We have run into a similar segmentation fault with Wordpress accessing an SQL database. In our case we have worked around the issue by renaming the database. The fault only occurred when the database name was four or less characters

LZL0 commented 6 years ago

Same issue, it looks like 3.22 works fine but 3.23 doesn't.

fredemmott commented 6 years ago

Can those of you except for @safe-net9 comment with what operating system and distribution + distribution version you're running on?

desbo commented 6 years ago

I'm getting this on HHVM 3.23.2 and Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-104-generic x86_64) on Drupal and Wordpress installations – however my database name is greater than 4 characters.

Drupal stack trace:

#0  PDO->exec() called at [/usr/share/drupal7/includes/database/mysql/database.inc:72]
#1  DatabaseConnection_mysql->__construct() called at [/usr/share/drupal7/includes/database/database.inc:1745]
#2  Database::openConnection() called at [/usr/share/drupal7/includes/database/database.inc:1535]
#3  Database::getConnection() called at [/usr/share/drupal7/includes/database/database.inc:2626]
#4  db_escape_table() called at [/usr/share/drupal7/includes/cache.inc:359]
#5  DrupalDatabaseCache->getMultiple() called at [/usr/share/drupal7/includes/cache.inc:340]
#6  DrupalDatabaseCache->get() called at [/usr/share/drupal7/includes/cache.inc:57]
#7  cache_get() called at [/usr/share/drupal7/includes/bootstrap.inc:1175]
#8  variable_initialize() called at [/usr/share/drupal7/includes/bootstrap.inc:2759]
#9  _drupal_bootstrap_variables() called at [/usr/share/drupal7/includes/bootstrap.inc:2520]
#10 drupal_bootstrap() called at [/usr/share/drupal7/includes/bootstrap.inc:2654]
#11 _drupal_bootstrap_page_cache() called at [/usr/share/drupal7/includes/bootstrap.inc:2512]
#12 drupal_bootstrap() called at [/usr/share/drupal7/index.php:20]
safe-net9 commented 6 years ago

I'm getting this on HHVM 3.23.2 and CentOS (Linux xxx.yyy.com 3.10.0-693.11.1.el7.x86_64 #1 SMP Mon Dec 4 23:52:40 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux) on Wordpress installation – however my database name is greater than 4 characters.

ocasta commented 6 years ago

HHVM 3.23.2 and Ubuntu 16.04.4 LTS with Wordpress

Dx3webs commented 6 years ago

dito HipHop VM 3.23.2 Ubuntu 16.04.4 LTS with Wordpress

pprasse commented 6 years ago

dito hhvm 3.23.2 / Ubuntu 16.04 LTS with custom Actindo Core1 framework

Database name is longer than 4 characters, so I suppose this might not be the issue.

pprasse commented 6 years ago

I opened a pull request in facebook/mysql-5.6 https://github.com/facebook/mysql-5.6/pull/781

Note: If you update third-party/webscalesqlclient/mysql-5.6 to facebook:fb-mysql-5.6.35, hhvm will not build because of incompatibilities with this branch in squangle. OTOH if you update third-party/webscalesqlclient/mysql-5.6 to Actindo:fb-mysql-5.6.35-fix-segfault-766, hhvm will build as I based this branch on the currently used tag prod201704

abdul commented 6 years ago

+1 - It doesn't work for on Ubuntu 16.04. Phabricator sets mysql charset, and that's where hhvm crashes. It has been working fine on Ubuntu 10.10, and I don't remember which version of HHVM was there.

fredemmott commented 6 years ago

Cause for this and related issues is that we build with Facebook's MySQL client (needed for the AsyncMySQLClient), which advertises itself as supporting 5.7, but actually only supports features used by Facebook's MySQL server.

Our MySQL team is going to make it so they're properly ignored - might be merging that PR, or applying the fix that was suggested in a reply a while back.

fredemmott commented 6 years ago

Workarounds:

Once this is fixed in the client lib, I'll backport it to the 3.24 branch. Once we've got a fix

fredemmott commented 6 years ago

We're doing a different mysql client fix - internal ID D6874150 , not yet on github though.

fredemmott commented 6 years ago

Repro on mac:

$ brew install mariadb
$ mysql.server start
$ mysql -u root
MariaDB [(none)]> 'create database foo;'
MariaDB [(none)]> ^D
Bye
$ hhvm -m debug
hphpd> $conn = mysqli_connect('localhost','root')
$conn = mysqli_connect('localhost','root')
hphpd> $conn->select_db('foo')
$conn->select_db('foo')
Core dumped: Segmentation fault: 11
Stack trace in /tmp/stacktrace.98083.log
[DBGINFO] Unexpected crash with connected debuggers!
Segmentation fault: 11
fredemmott commented 6 years ago

I can't reproduce the problem with master. I'd appreciate feedback on if it's fixed for your cases either with master, or tomorrow's nightlies (should be available in ~ 9 hours) - that would help with deciding when/if this gets backported to 3.24

cc @craigcarnell

c-holmes commented 6 years ago

I encountered this issue with HHVM 3.24.1 on Ubuntu 16.04, using MySQL 5.7 (on a vagrant vm). HHVM stops after a php exec() on a very simple sql script. Can provide my stack trace log if needed. My Database name did happen to be 4 characters and after updating to a 8 character name and rerunning the php exec(), I did not receive the Segmentation fault Error.

fredemmott commented 6 years ago

Can you try installing the HHVM-nightly package? I believe this was fixed on Friday, but want confirmation before doing a 3.24.2

c-holmes commented 6 years ago

Yea fixed my issue. I rebuilt the vm with the hhvm-nightly package and did not receive the Segmentation Fault error with a 4 character db name.

fredemmott commented 6 years ago

Great, I’ll roll it in the next few days. I strongly recommend running the nightly or a prior release instead of renaming the DB; it is still doing something bad, it’s just less visible.

fredemmott commented 6 years ago

https://hhvm.com/blog/2018/02/07/hhvm-3.24.2.html