PHP 5.5.6随机内存泄漏 [英] PHP 5.5.6 Random memory leak

查看:300
本文介绍了PHP 5.5.6随机内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

之后,我们已经迁移到PHP 5.5.6 阿帕奇2.4 从PHP 5.3 0.3 Kohana的3.3 遇到不时运行的每个网站内存不足。例外。

after we have migrated to PHP 5.5.6 and Apache 2.4 from PHP 5.3.3 every site that runs on Kohana 3.3 encounters from time to time a Out of memory exception.

完整的错误消息

PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 140316914598360 bytes) in Unknown on line 0

PHP说,它试图分配 127TB 的内存(末变化字节,但它仍然围绕TB)。它发生完全随机。有时你会得到没有问题了几个小时条纹和忽然1甚至10内存不足的消息行。它发生在所有项目,无论是Web服务连接到MySQL,MSSQL或MongoDB的或纯的网站。

PHP says it tries to allocate 127TB of memory (bytes at the end change, but its still around TB). It happens totally randomly. Sometimes you get a streak for few hours without a problem and the all of a sudden 1 or even 10 out of memory messages in row. It happens across all projects, be it webservices connecting to MySQL, MSSQL or MongoDB or plain website.

最糟糕的地方是这样的 - 在线0未知这告诉我的绝对没有。即使停用后注册 shutdown_function ,该消息并没有改变。

Worst thing is this - Unknown on line 0 which tells me absolutely nothing. Even after disabling the registered shutdown_function, the message did not change.

起初我一直怀疑 PDO DBLIB + freetds的的罪魁祸首,但无处使用而($行= $查询 - &GT;取()),如 HTTPS描述://bugs.php。净/ bug.php?ID = 64511 或<一个href=\"http://stackoverflow.com/questions/27481432/php-trying-to-allocate-127-tb-of-memory-and-memory-leak-with-$p$pg-match-and-$p$pg\">this问题。

At first I have suspected PDO dblib + freetds as the culprit, but got nowhere using while($row = $query->fetch()) as described in https://bugs.php.net/bug.php?id=64511 or this question.

到目前为止,我曾尝试:

So far I have tried:


  • 的XDebug

  • memory_usage()记录

  • 在httpd的strace的

他们都表明,内存分配是在完美的条件。

They all show that the memory allocation is in perfect condition.

只有 strace的显示了一些承诺,因为之前每出内存抛出的异常,是一堆<$的C $ C>则munmap 调用,显示内存不断下降,然后突然抛出异​​常。虽然我不知道它的可靠,因为日志的时间(从不同的呼叫)似乎都乱了套。

Only strace shows some promise, since before every out of memory exception thrown, is a bunch of munmap calls, which shows the memory keeps decreasing and then suddenly, throws an exception. Although I am not sure its reliable since the logs seemed mixed at times (from different calls).

已遍布类似的东西有人进来?

Has anyone come across something similar?

什么是调试这个问题的最佳步骤是什么?

What are the best steps to debug this problem?

目前,我出的我能做些什么的想法来解决这个...

At the moment, I am out of ideas in what I can do to resolve this...

推荐答案

我要回答自己,以供将来参考这一个。

I am going to answer this one for myself and for future reference.

实际的错误是 pdo_dblib 毕竟。根据这个bug - https://bugs.php.net/bug.php?id= 67130 这是我昨天发现 PDOStatement对象:: nextRowset()导致内存破坏,因此我们所有的问题。我通过去除我们的code的这一部分,让它没有它运行在抢交通12小时验证它。

The actual bug was in pdo_dblib after all. According to this bug - https://bugs.php.net/bug.php?id=67130 which I found yesterday PDOStatement::nextRowset() caused memory corruption and thus all our problems. I verified it by removing this portion of our code and let it run without it for 12 hours in "rush" traffic.

此bug已被使用 https://bugs.php.net/bug沿着固定的。 PHP?ID = 64511 ,我并没有在第一,这两个是相关的通知。

This bug was fixed along with https://bugs.php.net/bug.php?id=64511 and I did not notice at first that those two are related.

我们的系统运行在CentOS和PHP从软件集合安装,所以我们下载的源$ C ​​$ C表示模块与手动应用补丁,因为从雷米的RPM库中的同一个包的两个版本没有工作或间没有' T支持。

Our system runs on CentOS and PHP is installed from Software Collections, so we downloaded the source code of said module and applied the patch manually since two versions of the same package from Remi's RPM repository did not work or weren't compatible.

这真的很有趣,因为我们从 5.3.3 5.5.6 ,因为 https://bugs.php.net/bug.php?id=57593 (有几个bug报告和功能要求),其中 PDOStatement对象:: nextRowset()没有实现(它固定在5.3.7)。

It's really funny, because we migrated from 5.3.3 to 5.5.6 because of https://bugs.php.net/bug.php?id=57593 (there are several bug reports and feature requests) where PDOStatement::nextRowset() was not implemented (it was fixed in 5.3.7).

这篇关于PHP 5.5.6随机内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆