drpkcwwav20524605 2011-07-29 19:31
浏览 45

MongoCursorException'无法获取响应头'

I am developing a website using PHP and mongodb. I access the mongodb with PECL-mongo, and have run into an annoyance. Every now and then, I get an error like this (I've anonymized the paths)

Fatal error: Uncaught exception 'MongoCursorException' with message 'couldn't get response header' in
    /PATH/index.php:38 Stack trace: #0 
    /PATH/index.php(38): MongoCursor->rewind() #1 
    /PATH/template.inc(29): get_sidebar() #2 
    /PATH/index.php(13): 
    require_once('PATH/...') #3 {main} thrown in PATH/index.php on line 38

According to the documentation, this means:

The driver could not fetch a reply header from the database, so it gave up. Check if the database is still up and the network is connected and try the query again.

But I know that the database is up because I am doing this locally on my own machine over loopback. No connection is made to the outside world.

Simply trying again often works. Is this a possibly a bug in PHP's driver for mongo? Could this be a "miscompile" issue (I compiled from source, but with very benign flags, -march=native -O2)?

Has anyone seen this before?

Searching around, I only see references to some stupid facebook game having the same error.

EDIT: I just downgraded my PECL driver to version 1.1.4 and so far, the problem seems have gone away. So this may simply be a bug in the 1.2.x series. If anyone can shed any light on it, that would be great.

EDIT: I am not doing anything complex here, the code that is having the issue litterally looks like this:

$m = new Mongo();
$collection = $m->my_db->collection;
$results = $collection->find(array("favorite"=>true))->limit(5);
  • 写回答

1条回答 默认 最新

  • dqwr32867 2012-04-04 14:08
    关注

    i solved this problem with get new version mogodb.dll you can see http://www.mongodb.org/display/DOCS/PHP+Language+Center

    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘