mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-716: Proxy autogeneration fails with concurrent requests #884
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Jul 22, 2010).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user jakajancar:
When doing concurrent requests with autogeneration of proxies enabled, the proxy file does not exist when ProxyFactory tries to use it:
I think this is because file_put_contents is not atomic.
@doctrinebot commented on GitHub (Jul 22, 2010):
Comment created by jakajancar:
The following fixes it on Linux, but I think will not work in Windows (iirc, rename() on Windows won't work if the dest file already exists, much less atomically):
@doctrinebot commented on GitHub (Jul 22, 2010):
Comment created by jakajancar:
I don't even know why this is needed. Can't the file just be returned as string and eval()'d, instead of being written to a file and then require()'d?
@doctrinebot commented on GitHub (Jul 22, 2010):
Comment created by @beberlei:
we should just change file_put_Contents into:
@doctrinebot commented on GitHub (Jul 22, 2010):
Comment created by @beberlei:
Setting the LOCK_EX constant now, this should solve the issue.
However in high concurrency scenarios the "autoGenerateProxyClasses" flag should always be FALSE and the proxies be generated during build-time.
@doctrinebot commented on GitHub (Jul 22, 2010):
Comment created by jakajancar:
LOCK_EX doesn't fix it for me. Apparently it's still possible that the file doesn't exist:
Please note that my above uniqid+rename suggestion only works if more_entropy is true, if you decide to add it.
However, I'd much prefer having an option of just not using these files at all. I've created an Improvement ticket DDC-717 for this.
@doctrinebot commented on GitHub (Jul 23, 2010):
Comment created by @beberlei:
i now underestand what you are doing wrong.
if you set autogenerate = false you have to call doctrine orm:generate-proxies
@doctrinebot commented on GitHub (Jul 23, 2010):
Comment created by jakajancar:
I'm not setting it to false!
@doctrinebot commented on GitHub (Jul 23, 2010):
Comment created by @beberlei:
ah ok, eval is just a workaround.
@doctrinebot commented on GitHub (Jul 24, 2010):
Comment created by @beberlei:
Closed again, See DDC-717 for a timetable of a fix using auto-generate = true in production.
@doctrinebot commented on GitHub (Jul 24, 2010):
Issue was closed with resolution "Fixed"