Excessive proxy and hydrator generation causes Bus errors #484

Bilge opened this Issue Jan 29, 2013 · 13 comments


None yet
10 participants

Bilge commented Jan 29, 2013

When proxy and hydrator generation is enabled, as is typical for a dev environment, they are excessively regenerated even when the source file has not changed. The upshot of this is that the proxy or hydrator class may frequently be being written to at the same time as it is being accessed for reading by PHP. This not only causes a PHP fatal error but potentially multiple Apache Bus exceptions.

[error] [client] PHP Fatal error: Class 'Hydrator\DocumentsFooHydrator' not found in mongodb-odm/lib/Doctrine/ODM/MongoDB/Hydrator/HydratorFactory.php on line 146
[notice] child pid 12345 exit signal Bus error (7)
[notice] child pid 12347 exit signal Bus error (7)
[notice] child pid 12350 exit signal Bus error (7)

This will happen even on a single-developer system merely by accessing a page which has multiple assets that invoke Doctrine, e.g. images. If I refresh a page that has 20 assets on it, typically at least one will fail every time while the proxy or hydrator is being regenerated.


MDrollette commented Feb 1, 2013

I've noticed this as well, particularly using silex where the mongodb provider defaults to autogenerate.


jmikola commented Feb 11, 2013

This may be fixed by #445

I am still seeing this error after having updated to what I believe is the latest commit of the repositories, doctrine2, mongodb and mongodb-odm

I don't always see the hydrator error but I do see the apache bus error consistently when serving more than one concurrent request.

However, I think I may be missing something, and cannot find it in the documentation. @bilgexa comment states

When proxy and hydrator generation is enabled...

which suggests auto generation of proxies and hydrators can be disabled. Where is this documented?


jmikola commented May 2, 2013

@ReeseSys: The Configuration class controls this, and I believe the Symfony bundle exposes options for it. I doubt it's in the ODM documentation, though.

Same problem here.

It happens to me. When there are many concurrent connections, the error happens randomly as 500 (Internal Server Error) .

Also have this error: pages with multiple images served from GridFS cause random HTTP 500 errors. Server logs contain same bus errors. I'm using master-dev versions.


jmikola commented May 30, 2013

Can one of you guys collect a core dump from the crash? There are some steps for doing so in this blog article. Additionally, some phpinfo() output would help.

Am I correct in assuming the common thread for everyone is on a development environment where proxies and hydrators are being generated on each request?


Bilge commented May 30, 2013

Yes, it's not an issue on live where proxies and hydrators are cached.

Having the same problem here.

@bilgexa: Could you please excuse my ignorance and tell me what's necessary config setting for caching Hydrators and Proxies, as currently mine are generated on each request. Thanks

@marko986 I was ignorant until very recently.


I have the auto generate enabled/disabled with:

$env = getenv("ENVIRONMENT");
$autoGen = "DEVELOPMENT" == $env;

ENVIRONMENT is set in Apache VirtualHost config:


beberlei commented Aug 22, 2013

@jmikola yes the common issue fixes this by switching to EVAL strategy for development.


malarzm commented Jun 7, 2015

EVAL strategy for Proxies is available since #804 and for Hydrators it was implemented in #953

@malarzm malarzm closed this Jun 7, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment