Reputation: 1603
Please help. Working on a project with >8000 lines of code in a front controller architecture. As soon as I try to load a page, HHVM crashes with a segmentation fault. I've listed a sanitized stacktrace below with sensitive items replaced with ####.
Host: ####
ProcessID: 29669
ThreadID: 7fda7cbff700
ThreadPID: 29676
Name: unknown program
Type: Segmentation fault
Runtime: hhvm
Version: tags/HHVM-3.0.1-0-g97c0ac06000e060376fdac4a7970e954e77900d6
DebuggerCount: 0
Server_SERVER_NAME: ####
Server: ####
ThreadType: Web Request
URL: /####
# 0 HPHP::bt_handler(int) at crash-reporter.cpp:0
# 1 killpg at /lib/x86_64-linux-gnu/libc.so.6:0
# 2 memcpy at /usr/bin/hhvm:0
# 3 get_tty_password at /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18:0
# 4 mysql_stmt_fetch at /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18:0
# 5 HPHP::MySQLStmt::fetch() at /usr/bin/hhvm:0
# 6 HPHP::c_mysqli_stmt_ni_fetch(HPHP::Object const&) at ext_mysqli.cpp:0
# 7 HPHP::Native::callFunc(HPHP::Func const*, HPHP::TypedValue*, HPHP::TypedValue*, int, HPHP::TypedValue&) at /usr/bin/hhvm:0
# 8 HPHP::Native::methodWrapper(HPHP::ActRec*) at /usr/bin/hhvm:0
# 9 void HPHP::ExecutionContext::dispatchImpl<4>(int) at /usr/bin/hhvm:0
# 10 HPHP::ExecutionContext::enterVM(HPHP::ActRec*) at /usr/bin/hhvm:0
# 11 HPHP::ExecutionContext::invokeFunc(HPHP::TypedValue*, HPHP::Func const*, HPHP::Variant const&, HPHP::ObjectData*, HPHP::Class*, HPHP::VarEnv*, HPHP::StringData*, HPHP::ExecutionContext::InvokeFlags) at /usr/bin/hhvm:0
# 12 HPHP::ExecutionContext::invokeUnit(HPHP::TypedValue*, HPHP::Unit*) at /usr/bin/hhvm:0
# 13 HPHP::invoke_file(HPHP::String const&, bool, char const*) at /usr/bin/hhvm:0
# 14 HPHP::include_impl_invoke(HPHP::String const&, bool, char const*) at /usr/bin/hhvm:0
# 15 HPHP::hphp_invoke(HPHP::ExecutionContext*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, HPHP::Array const&, HPHP::VRefParamValue const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool, bool, bool) at /usr/bin/hhvm:0
# 16 HPHP::HttpRequestHandler::executePHPRequest(HPHP::Transport*, HPHP::RequestURI&, HPHP::SourceRootInfo&, bool) at /usr/bin/hhvm:0
# 17 HPHP::HttpRequestHandler::handleRequest(HPHP::Transport*) at /usr/bin/hhvm:0
# 18 HPHP::ServerWorker<std::shared_ptr<HPHP::FastCGIJob>, HPHP::FastCGITransportTraits>::doJobImpl(std::shared_ptr<HPHP::FastCGIJob>, bool) at /usr/bin/hhvm:0
# 19 HPHP::ServerWorker<std::shared_ptr<HPHP::FastCGIJob>, HPHP::FastCGITransportTraits>::doJob(std::shared_ptr<HPHP::FastCGIJob>) at /usr/bin/hhvm:0
# 20 HPHP::JobQueueWorker<std::shared_ptr<HPHP::FastCGIJob>, HPHP::Server*, true, false, HPHP::JobQueueDropVMStack>::start() at /usr/bin/hhvm:0
# 21 HPHP::AsyncFuncImpl::threadFuncImpl() at /usr/bin/hhvm:0
# 22 HPHP::AsyncFuncImpl::ThreadFunc(void*) at /usr/bin/hhvm:0
# 23 start_thread at /lib/x86_64-linux-gnu/libpthread.so.0:0
# 24 __clone at /lib/x86_64-linux-gnu/libc.so.6:0
PHP Stacktrace:
#0 mysqli_stmt->fetch() called at [/####.php:58]
#1 page->load() called at [/####.php:12]
#2 page->__construct(Object of class dependency could not be converted to string) called at [/####.php:32]
Upvotes: 3
Views: 1238
Reputation: 6898
This has been reported as two separate issues on the hhvm github: https://github.com/facebook/hhvm/issues/2921 and https://github.com/facebook/hhvm/issues/2377 .
The part that jumps out at me the most is that it's failing on the function "get_tty_password", which is what it runs to prompt you to enter your mysql password on the keyboard (for example, if you type "mysql -p" and it prompts you "Enter password:".) Obviously, prompting like this is an absurdity if it's being run via HHVM.
While HHVM segfaulting shouldn't be expected behaviour, and there are open issues to fix the segfault itself, the most likely cause is your application not setting the password in your mysqli connection. Double-check that this password is set (try explicitly setting it in whatever connection string your using, as it might be trying to load it from a variable that doesn't have it set.)
Upvotes: 1
Reputation: 10900
The 3.0.1 version was known to cause segmentation faults. Version 3.1 was launched yesterday and apparently it fixes the segfaults for most situations1. You should consider upgrading, maybe it will work.
1 there still are some issues with this, see for example this one.
Upvotes: 1