Details
Description
When doing concurrent requests with autogeneration of proxies enabled, the proxy file does not exist when ProxyFactory tries to use it:
Doctrine/ORM/Proxy/ProxyFactory.php(92): spl_autoload_call('MyClassProxy'))
I think this is because file_put_contents is not atomic.
Activity
Benjamin Eberlei
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Assignee | Roman S. Borschel [ romanb ] | Benjamin Eberlei [ beberlei ] |
| Fix Version/s | 2.0-BETA3 [ 10060 ] | |
| Resolution | Fixed [ 1 ] |
Jaka Jancar
made changes -
| Resolution | Fixed [ 1 ] | |
| Status | Resolved [ 5 ] | Reopened [ 4 ] |
Benjamin Eberlei
made changes -
| Status | Reopened [ 4 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] |
Benjamin Eberlei
made changes -
| Workflow | jira [ 11672 ] | jira-feedback [ 14518 ] |
Benjamin Eberlei
made changes -
| Workflow | jira-feedback [ 14518 ] | jira-feedback2 [ 16382 ] |
Benjamin Eberlei
made changes -
| Workflow | jira-feedback2 [ 16382 ] | jira-feedback3 [ 18635 ] |
This list may be incomplete, as errors occurred whilst retrieving source from linked applications:
- Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-716, expand=changesets[-21:-1].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)
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):
--- Proxy/ProxyFactory.php (revision 2) +++ Proxy/ProxyFactory.php (working copy) @@ -144,7 +144,9 @@ $file = str_replace($placeholders, $replacements, $file); - file_put_contents($fileName, $file); + $tmpFileName = $fileName.'-'.uniqid('', true);; + file_put_contents($tmpFileName, $file); + rename($tmpFileName, $fileName); } /**