Comments (21)
I just give v1.0.3 once again a shot. Production server got updated:
- php 7.0.6
- mongodb 3.2.6
- Symfony 3.0.6
maybe there was an issue with php which got fixed.
from mongo-php-adapter.
Can you please provide a trace or a sample of what you're doing that causes the error? Without any of that it's hard to figure out what's going on.
from mongo-php-adapter.
I've digged into the logfiles and found this:
[2016-04-14 08:16:27] request.INFO: Matched route "Start". {"route_parameters":{"_controller":"test\\TestBundle\\Controller\\TestController::indexAction","_route":"Start"},"request_uri":"http://test/"} {"file":"/../vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php","line":109,"class":"Symfony\\Component\\HttpKernel\\EventListener\\RouterListener","function":"onKernelRequest"}
[2016-04-14 08:16:27] security.DEBUG: Remember-me cookie detected. [] {"file":"/../vendor/symfony/symfony/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php","line":113,"class":"Symfony\\Component\\Security\\Http\\RememberMe\\AbstractRememberMeServices","function":"autoLogin"}
[2016-04-14 08:16:27] doctrine.DEBUG: MongoDB query: {"find":true,"query":{"username":"mrohnstock"},"fields":[],"db":"test","collection":"user"} [] {"file":"/../vendor/doctrine/mongodb-odm-bundle/Logger/Logger.php","line":66,"class":"Doctrine\\Bundle\\MongoDBBundle\\Logger\\Logger","function":"logQuery"}
[2016-04-14 08:16:27] doctrine.DEBUG: MongoDB query: {"limit":true,"limitNum":1,"query":{"username":"mrohnstock"},"fields":[]} [] {"file":"/../vendor/doctrine/mongodb-odm-bundle/Logger/Logger.php","line":66,"class":"Doctrine\\Bundle\\MongoDBBundle\\Logger\\Logger","function":"logQuery"}
[2016-04-14 08:16:27] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalErrorException: "Error: Nesting level too deep - recursive dependency?" at /../vendor/alcaeus/mongo-php-adapter/lib/Alcaeus/MongoDbAdapter/TypeConverter.php line 103 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 0): Error: Nesting level too deep - recursive dependency? at /../vendor/alcaeus/mongo-php-adapter/lib/Alcaeus/MongoDbAdapter/TypeConverter.php:103)"} {"file":"/../vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php","line":89,"class":"Symfony\\Component\\HttpKernel\\EventListener\\ExceptionListener","function":"logException"}
Not really helpful, I think...
from mongo-php-adapter.
Hm ... the document with username mrohnstock
in collection user
was damaged. I've resetted the document from a backup shortly before the update and will see, if this issue occur again.
from mongo-php-adapter.
now I receive a different exception... MongoCursorException: '$set' is empty. You must specify a field like so: {$set: {<field>: ...}}
.
Stacktrace:
[1] MongoCursorException: '$set' is empty. You must specify a field like so: {$set: {<field>: ...}}
at n/a
in /../vendor/alcaeus/mongo-php-adapter/lib/Alcaeus/MongoDbAdapter/ExceptionConverter.php line 83
at Alcaeus\MongoDbAdapter\ExceptionConverter::toLegacy(object(BulkWriteException))
in /../vendor/alcaeus/mongo-php-adapter/lib/Mongo/MongoCollection.php line 397
at MongoCollection->update(array('_id' => object(MongoId)), array('$set' => array('lastSeen' => '1460630013')), array())
in /../vendor/doctrine/mongodb/lib/Doctrine/MongoDB/Collection.php line 1442
at Doctrine\MongoDB\Collection->doUpdate(array('_id' => object(MongoId)), array('$set' => array('lastSeen' => '1460630013')), array())
in /../vendor/doctrine/mongodb/lib/Doctrine/MongoDB/Collection.php line 860
at Doctrine\MongoDB\Collection->update(array('_id' => object(MongoId)), array('$set' => array('lastSeen' => '1460630013')), array())
in /../vendor/doctrine/mongodb/lib/Doctrine/MongoDB/LoggableCollection.php line 374
at Doctrine\MongoDB\LoggableCollection->update(array('_id' => object(MongoId)), array('$set' => array('lastSeen' => '1460630013')), array())
in /../vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php line 400
at Doctrine\ODM\MongoDB\Persisters\DocumentPersister->update(object(User), array())
in /../vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php line 1231
at Doctrine\ODM\MongoDB\UnitOfWork->executeUpdates(object(ClassMetadata), array('000000006bb7290700000000186187bf' => object(User)), array())
in /../vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php line 426
at Doctrine\ODM\MongoDB\UnitOfWork->commit(null, array())
in /../vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php line 528
at Doctrine\ODM\MongoDB\DocumentManager->flush()
in /../src/test/TestBundle/Listener/RootListener.php line 140
at test\TestBundle\Listener\RootListener->onKernelFinishRequest(object(FinishRequestEvent), 'kernel.finish_request', object(TraceableEventDispatcher))
in line
at call_user_func(array(object(RootListener), 'onKernelFinishRequest'), object(FinishRequestEvent), 'kernel.finish_request', object(TraceableEventDispatcher))
in /../vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php line 61
at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(object(FinishRequestEvent), 'kernel.finish_request', object(ContainerAwareEventDispatcher))
in line
at call_user_func(object(WrappedListener), object(FinishRequestEvent), 'kernel.finish_request', object(ContainerAwareEventDispatcher))
in /../app/cache/dev/classes.php line 1751
at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.finish_request', object(FinishRequestEvent))
in /../app/cache/dev/classes.php line 1669
at Symfony\Component\EventDispatcher\EventDispatcher->dispatch('kernel.finish_request', object(FinishRequestEvent))
in /../vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php line 132
at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch('kernel.finish_request', object(FinishRequestEvent))
in /../vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 198
at Symfony\Component\HttpKernel\HttpKernel->finishRequest(object(Request), '1')
in /../vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 181
at Symfony\Component\HttpKernel\HttpKernel->filterResponse(object(Response), object(Request), '1')
in /../vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 161
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
in /../vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 62
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
in /../vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php line 169
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in /../web/index_dev.php line 34
[2] MongoDB\Driver\Exception\BulkWriteException: '$set' is empty. You must specify a field like so: {$set: {<field>: ...}}
at n/a
in /../vendor/mongodb/mongodb/src/Operation/Update.php line 121
at MongoDB\Driver\Server->executeBulkWrite('test.user', object(BulkWrite), object(WriteConcern))
in /../vendor/mongodb/mongodb/src/Operation/Update.php line 121
at MongoDB\Operation\Update->execute(object(Server))
in /../vendor/mongodb/mongodb/src/Operation/UpdateOne.php line 68
at MongoDB\Operation\UpdateOne->execute(object(Server))
in /../vendor/mongodb/mongodb/src/Collection.php line 712
at MongoDB\Collection->updateOne(object(BSONDocument), object(BSONDocument), array('writeConcern' => object(WriteConcern)))
in /../vendor/alcaeus/mongo-php-adapter/lib/Mongo/MongoCollection.php line 394
at MongoCollection->update(array('_id' => object(MongoId)), array('$set' => array('lastSeen' => '1460630013')), array())
in /../vendor/doctrine/mongodb/lib/Doctrine/MongoDB/Collection.php line 1442
at Doctrine\MongoDB\Collection->doUpdate(array('_id' => object(MongoId)), array('$set' => array('lastSeen' => '1460630013')), array())
in /../vendor/doctrine/mongodb/lib/Doctrine/MongoDB/Collection.php line 860
at Doctrine\MongoDB\Collection->update(array('_id' => object(MongoId)), array('$set' => array('lastSeen' => '1460630013')), array())
in /../vendor/doctrine/mongodb/lib/Doctrine/MongoDB/LoggableCollection.php line 374
at Doctrine\MongoDB\LoggableCollection->update(array('_id' => object(MongoId)), array('$set' => array('lastSeen' => '1460630013')), array())
in /../vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php line 400
at Doctrine\ODM\MongoDB\Persisters\DocumentPersister->update(object(User), array())
in /../vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php line 1231
at Doctrine\ODM\MongoDB\UnitOfWork->executeUpdates(object(ClassMetadata), array('000000006bb7290700000000186187bf' => object(User)), array())
in /../vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/UnitOfWork.php line 426
at Doctrine\ODM\MongoDB\UnitOfWork->commit(null, array())
in /../vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php line 528
at Doctrine\ODM\MongoDB\DocumentManager->flush()
in /../src/test/TestBundle/Listener/RootListener.php line 140
at test\TestBundle\Listener\RootListener->onKernelFinishRequest(object(FinishRequestEvent), 'kernel.finish_request', object(TraceableEventDispatcher))
in line
at call_user_func(array(object(RootListener), 'onKernelFinishRequest'), object(FinishRequestEvent), 'kernel.finish_request', object(TraceableEventDispatcher))
in /../vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php line 61
at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(object(FinishRequestEvent), 'kernel.finish_request', object(ContainerAwareEventDispatcher))
in line
at call_user_func(object(WrappedListener), object(FinishRequestEvent), 'kernel.finish_request', object(ContainerAwareEventDispatcher))
in /../app/cache/dev/classes.php line 1751
at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.finish_request', object(FinishRequestEvent))
in /../app/cache/dev/classes.php line 1669
at Symfony\Component\EventDispatcher\EventDispatcher->dispatch('kernel.finish_request', object(FinishRequestEvent))
in /../vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php line 132
at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch('kernel.finish_request', object(FinishRequestEvent))
in /../vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 198
at Symfony\Component\HttpKernel\HttpKernel->finishRequest(object(Request), '1')
in /../vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 181
at Symfony\Component\HttpKernel\HttpKernel->filterResponse(object(Response), object(Request), '1')
in /../vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 161
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
in /../vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 62
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
in /../vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php line 169
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in /../web/index_dev.php line 34
from mongo-php-adapter.
The document with username mrohnstock
in collection user
got once again corrupted.
from mongo-php-adapter.
As for the empty $set
, this is being tracked in #93. I have yet to figure out whether that is an issue with mongo-php-adapter or mongo-php-library.
When you say "corrupted", can you be more specific?
from mongo-php-adapter.
When you say "corrupted", can you be more specific?
the only field, that this document holds, is _id
, nothing else. All other fields got removed (as would the whole document got overwritten with just { _id : ObjectId("SAME ID AS BEFORE") }
).
from mongo-php-adapter.
You don't happen to be running this on a replicated environment? That would mean you could check the oplog to see what queries get sent to the server.
However, in combination with the empty $set
this looks like somewhere there are empty updates to the document - which is troubling because I don't know where that would be coming from.
from mongo-php-adapter.
You don't happen to be running this on a replicated environment? That would mean you could check the oplog to see what queries get sent to the server.
no, sorry :(.
from mongo-php-adapter.
Dang. Worth a shot. Anyways, let's focus on nesting level too deep, as the other issue is getting a lot of attention in #93 and mongodb/mongo-php-driver#293.
Since the nesting level error occurs with 1.0.3 and not 1.0.2, could you try to provide a test case that reproduces the error? Right now I think #98 might have something to do with it but I'm not sure. You don't happen to have a trace for the nesting level too deep exception?
from mongo-php-adapter.
no, after I resetted the document by backup, the nesting level error didn't appear again :( - only different exceptions appear as posted.
from mongo-php-adapter.
Right. In that case, I'd close this issue and defer the empty $set
and data corruption (which I think are related) to one of the tickets mentioned above. If the recursion issue re-appears, please re-open this ticket with any additional information you might have. Thanks!
from mongo-php-adapter.
I can confirm this problem.
- ubuntu 16.04
- php 7.0.4
- mongodb 2.6.10
- php mongodb extension 1.1.6
- Symfony 2.8.6
- doctrine-mongodb 1.3.0
- doctrine-mongodb-odm-bundle 3.1.0
This is the stack trace:
2016/05/10 14:38:06 [error] 1445#1445: *13550 FastCGI sent in stderr: "PHP message: PHP Fatal error: Nesting level too deep - recursive dependency? in /var/www/mcs-reporting-portal/vendor/alcaeus/mongo-php-adapter/lib/Alcaeus/MongoDbAdapter/TypeConverter.php on line 103
PHP message: PHP Stack trace:
PHP message: PHP 1. {main}() /var/www/mcs-reporting-portal/public/app_dev.php:0
PHP message: PHP 2. Symfony\Component\HttpKernel\Kernel->handle() /var/www/mcs-reporting-portal/public/app_dev.php:20
PHP message: PHP 3. Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle() /var/www/mcs-reporting-portal/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:185
PHP message: PHP 4. Symfony\Component\HttpKernel\HttpKernel->handle() /var/www/mcs-reporting-portal/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php:69
PHP message: PHP 5. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /var/www/mcs-reporting-portal/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:62
PHP message: PHP 6. Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch() /var/www/mcs-reporting-portal/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:120
PHP message: PHP 7. Symfony\Component\EventDispatcher\EventDispatcher->dispatch() /var/www/mcs-reporting-portal/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php:136
PHP message: PHP 8. Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() /var/www/mcs-reporting-portal/app/cache/dev/classes.php:1777
PHP message: PHP 9. call_user_func:{/var/www/mcs-reporting-portal/app/cache/dev/classes.php:1862}() /var/www/mcs-reporting-portal/app/cache/dev/classes.php:1862
PHP message: PHP 10. Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke() /var/www/mcs-reporting-portal/app/cache/dev/classes.php:1862
PHP message: PHP 11. call_user_func:{/var/www/mcs-reporting-portal/
When I restart php-fpm, it works again. Then after a couple of requests, the same error occur. Unfortunately I dont find a broken document or anything, as there is just too much data to look at...
After downgrading to 1.0.2, everything seem to work fine.
from mongo-php-adapter.
looks like the stacktrace is somewhat broken too :( sorry
from mongo-php-adapter.
yes, 1.0.3 is unusable for my project, too. I think @alcaeus is right with #106. What I can say, with 1.0.2 I did not receive any type of exceptions - yet...
from mongo-php-adapter.
After downgrading to 1.0.2, everything seem to work fine.
What I can say, with 1.0.2 I did not receive any type of exceptions - yet...
That makes no sense. TypeConverter itself hasn't changed since BETA-1. The only difference between 1.0.3 and 1.0.2 affecting type conversion is the addition of a missing type conversion in query projections for find
and findOne
. This shouldn't be an issue though, since query projection normally aren't deeply nested documents (unless you include fancy $elemMatch
expressions in them).
At the moment, I don't know what I could do to fix this since I'm not even sure where this would come from. As I mentioned in the previously linked comment, there are a lot of factors that decide whether a call is deemed recursing too deep. So, for now, please keep an eye out and let me know what happens. If you are able to consistently reproduce this or add enough logging to figure out which documents cause I can take another look - right now there isn't much to look at.
from mongo-php-adapter.
Yea, its a very strange behavior. In my case, I'm doing
$collection = $this->getMongoClient()->selectDB($db)->selectCollection($collectionName);
$result = $collection->aggregateCursor($query);
the query is something like (shortened)
[
{
"$unwind":"$transactions"
},
{
"$match":{
"$and":[
{
"project.$id":{
"$in":[
"..."
]
}
},
{
"transactions.outDate":{
"$gte":{
"sec":1431329309,
"usec":0
}
}
}
]
}
},
{
"$group":{
"_id":"$productCode",
"outLast12MonthQty":{
"$sum":"$transactions.outQty"
},
"productPrice":{
"$first":"$productPrice"
}
}
}
]
...on documents that have a property "transactions" which has a collection of nested documents. But it is not consistently reproducible. I guess there is one or more documents that are somewhat corrupted as @mrohnstock already mentioned.
The strangest part of all is, that the problem somehow destroys the opcache, because after the error occurs, the whole system (i.e. other queries) dont work anymore. So I have to restart php-fpm. I'll keep an eye on that. Maybe I find the time to dig into it a little more.
from mongo-php-adapter.
Alright, v1.0.3 is running very good since about 6 days in production so far :). Nothing to report.
from mongo-php-adapter.
Interesting. Keeping my fingers crossed for you guys, sorry I can't do much about this.
from mongo-php-adapter.
Same problem and same PHP version: 7.0.5.
I will try to update PHP and report here if the error go away.
from mongo-php-adapter.
Related Issues (20)
- install mango php adapter with composer and use php.ini ? HOT 1
- support for NO_MAX_STALENESS and SMALLEST_MAX_STALENESS_SECONDS for readPreference HOT 2
- Receiving Notice: Undefined index: ok
- MongoDate conversion to DateTime fails in ambiguous edge case HOT 1
- No such command: 'group' HOT 1
- $collection->save Doesn't work on sharded collection (since 4.2) HOT 8
- DateTimeInterface converted to BSON in php 7.4 as empty BSONDocument
- Whether the latest version of Ext-mongodb is supported HOT 5
- Data returned in incorrect format HOT 1
- ns field deprecated HOT 1
- Issue with types after upgrading to PHP 7.4 HOT 1
- PHP 8.1.0, a class which implements Serializable deprecated HOT 2
- Need MongoDB 5.0 support HOT 3
- PHP 8.1 Support HOT 1
- PHP 8.2 compatibility HOT 1
- MongoClient readPreferenceTags options parameter HOT 2
- MongoDB\generate_index_name method doesn't exist. HOT 1
- Version 1.2.4 introduces regression HOT 1
- PHP 8.2 Error TypeConverter and MongoId HOT 1
- PHP Version Support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongo-php-adapter.