PHP项目中的hhvm分段错误

时间:2014-05-30 00:58:28

标签: php nginx segmentation-fault stack-trace hhvm

请帮忙。在前端控制器架构中处理具有> 8000行代码的项目。一旦我尝试加载页面,HHVM就会因分段错误而崩溃。我在下面列出了一个已清理的堆栈跟踪,其中敏感项目替换为####。

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]

2 个答案:

答案 0 :(得分:1)

众所周知,3.0.1版本会导致分段错误。版本3.1已启动yesterday,显然它修复了大多数情况 1 的段错误。你应该考虑升级,也许它会起作用。

1 还存在一些问题,例如参见this one

答案 1 :(得分:1)

这已被报告为hhvm github上的两个独立问题:https://github.com/facebook/hhvm/issues/2921https://github.com/facebook/hhvm/issues/2377

对我跳出最多的部分是它在函数“get_tty_password”上失败,这就是它运行以提示你在键盘上输入你的mysql密码(例如,如果你键入“mysql -p” “并且它会提示你”输入密码:“。)显然,如果通过HHVM运行,这样的提示是荒谬的。

虽然HHVM segfaulting不应该是预期的行为,并且存在修复segfault本身的开放问题,但最可能的原因是您的应用程序没有在mysqli连接中设置密码。仔细检查是否设置了此密码(尝试在您使用的任何连接字符串中明确设置它,因为它可能尝试从未设置它的变量加载它。)