Reputation: 3133
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:
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
Upvotes: 0
Views: 805
Reputation: 36784
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.
Upvotes: 1