CakePHP / MongoDB:定期读取失败
我正在尝试使用来自 ichikaway 的 cakephp-mongodb 驱动程序在 Ubuntu 11.10 上使用 MongoDB 和 CakePHP 1.3,但我看到持续的连接问题。
我的模型非常简单。我正在尝试连接和读取,
$this->loadModel('Mongo.Mpoint');
$data = $this->Mpoint->find('first');
但结果不一致。服务器返回的时间很长
错误 324 (net::ERR_EMPTY_RESPONSE):服务器关闭了连接 不发送任何数据。
然而,发出刷新或快速连续多次刷新将最终提供预期的返回数据。感觉就像服务器要进入睡眠状态并需要被唤醒,因为反复按回车键不会产生错误,但这是主观的。崩溃发生在查找中,而不是连接本身。
我在服务器上安装了rockmongo,它永远不会连接失败。另外,如果我将连接指向不同的服务器(相同版本的 mongo,但在 centos 上),我也会看到相同的行为,所以我不认为问题出在 mongodb 本身。
我尝试将连接设置为持久并直接设置超时,但均未成功。
我的同事也有一个直接在 centos 服务器上运行的应用程序的副本,他说他最初看到了这个问题,但“它消失了”。
因此,据我所知,问题很可能出现在 cakePHP 层,因为不同服务器之间的连接会产生相同的结果,并且 PHP 中的直接连接是没有问题的,但放置诊断并不会显示任何立即使用的内容。看到 PHP 完全崩溃而服务器没有返回任何有用的信息,这是相当奇怪的。有其他人以前见过这种行为并修复它吗?
I am trying to use MongoDB on Ubuntu 11.10 with CakePHP 1.3 using the cakephp-mongodb driver from ichikaway, but I am seeing persistent connection problems.
My model is very simple. I am attempting a connect and a read
$this->loadModel('Mongo.Mpoint');
$data = $this->Mpoint->find('first');
However the result is inconsistent. A significant amount of the time the server returns
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection
without sending any data.
However issuing a refresh, or several refreshes in quick succession will eventually deliver the expected returned data. It feels like the server is going to sleep and needs to be woken up as repeatedly hitting return does not generate errors, but this is subjective. The crash occurs in the find, not the connection itself.
I have rockmongo installed on the server which never fails to connect. Also I see the same behaviour if I point the connection at a different sever (same version of mongo, but on centos) so I do not believe the issue is with mongodb itself.
I have attempted setting the connection to persistent and directly setting the timeout, all without success.
My colleague, who also has a copy of the app running directly on the centos server, says he saw this problem initially, but 'it went away'.
From what I can see therefore the issue is most likely in the cakePHP layer as connections across different servers yields the same result and a direct connection in PHP is trouble-free, but placing diagnostics does not reveal anything of immediate use. It is rather odd to see a complete PHP crash with nothing useful returned from the server. Has anyone else seen this behaviour before and fixed it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试更新 Mongodb php 驱动程序。我遇到了同样的问题,我刚刚从
1.2.7
升级到1.2.9
,它似乎已经解决了。仅供参考
我正在使用
Try updating the Mongodb php driver. I had the same problem and I just upgraded from
1.2.7
to1.2.9
and It seems to have been solved.Just for reference
I am using