dse323222 2012-05-10 00:32
浏览 61
已采纳

too long

I am working on a Symfony2 project using Doctrine and MongoDB. To say the least, everything has been working great, until today when I uncovered a problem.

Queries that return one or more records/documents are apparently causing the PHP process to die. To be more specific, this is only happening with queries where "file" results are returned. I do not get a PHP error, and there are also no errors logged to the apache error log.

When I hit the URL that causes this query to run, I get net::ERR_EMPTY_RESPONSE in Chrome. I can output content with echo 'test';exit() just before the query, and I see the content in my browser. If I put the same echo 'test';exit(); line right after the query, I get the empty response error.

I have a development environment setup on my computer, which includes the LAMP stack. However, I have this configured to connect to my remote MongoDB instance. I have no problems when querying for files using my local setup. The various service versions are slightly different between my computer and server. Based on this observation, it seems as if it is not a MongoDB service issue, but maybe a PHP extension issue?

I add that I am able to successfully store files using the services on my server. But I can only query/retrieve the data on my local setup.

Is any log content generated when PHP dies like this?

I am running the following service versions:

  • OS: Ubuntu 12.04 LTS
  • Apache: 2.2.22
  • PHP: 5.3.10-1ubuntu3.1
  • Mongo PHP extension: 1.2.10
  • MongoDB-10gen: 2.0.5

Any help would be greatly appreciated. I have tried everything I know and have yet to find any clue as to what is actually causing this to happen.

--

My model looks like this:

<?php

namespace Project\Bundle\Document;

use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @MongoDB\Document
 */
class File {

/**
 * @MongoDB\Id(strategy="auto")
 */
protected $id;

/**
 * @MongoDB\ObjectId
 * @MongoDB\Index
 * @Assert\NotBlank
 */
protected $userId;

/**
 * @MongoDB\ObjectId
 * @MongoDB\Index
 */
protected $commonId;

/**
 * @MongoDB\File
 */
public $file;

/**
 * @MongoDB\String
 */
public $mimeType;

/**
 * @MongoDB\Hash
 */
public $meta;

... getters / setters ...

?>

I turned on verbose logging for the MongoDB server, and the query appears to run fine:

Wed May  9 20:04:29 [conn1] queryd dbdev.File.files query: { $query: { commonId: ObjectId('4fab01396bd985c215000000'), meta.size: "large" }, $orderby: {} } ntoreturn:1 nreturned:1 reslen:258 0ms
Wed May  9 20:04:29 [conn1] end connection 127.0.0.1:42087
Wed May  9 20:04:30 [DataFileSync] flushing mmap took 0ms  for 5 files
Wed May  9 20:04:30 [DataFileSync] flushing diag log
Wed May  9 20:04:30 [PeriodicTask::Runner] task: WriteBackManager::cleaner took: 0ms
Wed May  9 20:04:30 [PeriodicTask::Runner] task: DBConnectionPool-cleaner took: 0ms
Wed May  9 20:04:30 [PeriodicTask::Runner] task: DBConnectionPool-cleaner took: 0ms
Wed May  9 20:04:30 [clientcursormon] mem (MB) res:46 virt:997 mapped:160

UPDATE

I used strace to find the following segmentation fault in Apache:

en("/opt/dev/app/cache/dev/doctrine/odm/mongodb/Hydrators/ProjectBundleDocumentFileHydrator.php", O_RDONLY) = 28
fstat(28, {st_mode=S_IFREG|0777, st_size=2462, ...}) = 0
fstat(28, {st_mode=S_IFREG|0777, st_size=2462, ...}) = 0
fstat(28, {st_mode=S_IFREG|0777, st_size=2462, ...}) = 0
fstat(28, {st_mode=S_IFREG|0777, st_size=2462, ...}) = 0
mmap(NULL, 2462, PROT_READ, MAP_SHARED, 28, 0) = 0x7fa3ae356000
munmap(0x7fa3ae356000, 2462)            = 0
close(28)                               = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
chdir("/etc/apache2")                   = 0
rt_sigaction(SIGSEGV, {SIG_DFL, [], SA_RESTORER|SA_INTERRUPT, 0x7fa3b3ce4cb0}, {SIG_DFL, [], SA_RESTORER|SA_RESETHAND, 0x7fa3b3ce4cb0}, 8) = 0
kill(5020, SIGSEGV)                     = 0
rt_sigreturn(0x139c)                    = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
Process 5020 detached
  • 写回答

1条回答 默认 最新

  • dongmacuo1193 2012-05-10 10:14
    关注

    This sounds like a bug which I've fixed on May 3rd. I would suggest you try the latest version of github (the v1.2 branch!). It also helps if you would include your phpinfo() section on "mongodb". If you still have an issue, please file a bug report with a small reproducible script at http://jira.mongodb.org/browse/PHP.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多
  • ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。
  • ¥60 fail to initialize keyboard hotkeys through kernel.0000000000
  • ¥30 ppOCRLabel导出识别结果失败
  • ¥15 Centos7 / PETGEM
  • ¥15 csmar数据进行spss描述性统计分析
  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 wpf界面一直接收PLC给过来的信号,导致UI界面操作起来会卡顿