Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDC-3858: Doctrine SLC and @version, failure to get optimistic lock #4709

Open
doctrinebot opened this issue Jul 31, 2015 · 1 comment
Open
Labels

Comments

@doctrinebot
Copy link

Jira issue originally created by user dorrogeray:

Greetings everyone,

UPDATE: As a temporary workaround, I switched to the less performant READ_WRITE with the basic filelock implementation, and the problem went away.

I am using Doctrine 2.5 with SLC enabled (memcached) and I have encountered some strange behaviour. When doctrine fetches entities from cache, the @Version column is actually set to NULL instead of whatever value is correctly in the database - looks like the @Version doesn't get updated as far as cache is concerned.

Note that afected entity uses @Orm\Cache(usage="NONSTRICT_READ_WRITE", region="Entity\Contact")

If I restart memcached, correct @Version is loaded (because of the force reload).

This also leads to failure to get optimistic lock (due to incorrectly evaluated version mismatch).

I have no idea, but could this be somehow related to http://www.doctrine-project.org/jira/browse/[DDC-3781](http://www.doctrine-project.org/jira/browse/DDC-3781) ?

For now, Ill try to prevent this issue from occurring by clearing updated entities from cache, and thus forcing their reload by whoever will request them next.

Thanks for any response/advice!

Here is part of call stack, this time failing on different entity, but for the same reason:
#0 /var/www/TravelSupport/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(483): Doctrine\ORM\OptimisticLockException::lockFailed(Object(DoctrineORMModule\Proxy*CG\CsnTour\Entity\Customer))
#1 /var/www/TravelSupport/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(366): Doctrine\ORM\Persisters\Entity\BasicEntityPersister->updateTable(Object(DoctrineORMModule\Proxy
CG\CsnTour\Entity\Customer), 'customer', Array, true)
#2 /var/www/TravelSupport/vendor/doctrine/orm/lib/Doctrine/ORM/Cache/Persister/Entity/NonStrictReadWriteCachedEntityPersister.php(95): Doctrine\ORM\Persisters\Entity\BasicEntityPersister->update(Object(DoctrineORMModule\Proxy
CG\CsnTour\Entity\Customer))
#3 /var/www/TravelSupport/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(1069): Doctrine\ORM\Cache\Persister\Entity\NonStrictReadWriteCachedEntityPersister->update(Object(DoctrineORMModule\Proxy
CG*\CsnTour\Entity\Customer))
#4 /var/www/TravelSupport/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(384): Doctrine\ORM\UnitOfWork->executeUpdates(Object(Doctrine\ORM\Mapping\ClassMetadata))
#5 /var/www/TravelSupport/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(356): Doctrine\ORM\UnitOfWork->commit(NULL)
#6 /var/www/TravelSupport/module/CsnTour/src/CsnTour/Controller/TicketController.php(2014): Doctrine\ORM\EntityManager->flush()

@doctrinebot
Copy link
Author

Comment created by @FabioBatSilva:

[~dorrogeray],
Can you please add a failing test case ?

If you need help to write the test you can use this ticket as a reference.

@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant