-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Remove randomness from dumped containers #25671
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
Conversation
cb7046b
to
23cb152
Compare
$version = (new Definition(\ReflectionClass::class))->addArgument(new Reference('service_container')); | ||
$version = (new Definition())->setFactory(array($version, 'getFileName')); | ||
$version = (new Definition())->setFactory('implode')->addArgument(array( | ||
(new Definition())->setFactory('filemtime')->addArgument($version), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hum actually this incurs unwanted IO, I need to look for something else
b8553e3
to
bd4161f
Compare
PR ready (fabbot failure is false positive.) |
bd4161f
to
7186d0e
Compare
(failure caused by bug in Composer, see composer/composer#6973) |
Could be retried now with the new release then :) |
PR green (deps=high failure will be fixed by merging to upper branches) |
@@ -20,7 +20,7 @@ | |||
"ext-xml": "*", | |||
"symfony/cache": "~3.4|~4.0", | |||
"symfony/class-loader": "~3.2", | |||
"symfony/dependency-injection": "~3.4|~4.0", | |||
"symfony/dependency-injection": "~3.4.3|~4.0.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shoudn't it be ^3.4.3|^4.0.3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oups, fixed
7186d0e
to
14dd5d1
Compare
Thank you @nicolas-grekas. |
1 similar comment
Thank you @nicolas-grekas. |
This PR was merged into the 3.4 branch. Discussion ---------- Remove randomness from dumped containers | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - With this PR, the generated container is immutable by cache clearing: it doesn't contain any random string anymore (well, third party bundles can add random things back, but at least core doesn't). Since the class+file name of the container is based on a hash of its content, it means that they are now stable also. This should help fix some edge cases/race conditions during cache clears/rebuilds. (fabbot failure is false positive) Commits ------- 14dd5d1 Remove randomness from dumped containers
After updating to symfony 3.4.3 I get the following error:
|
@mcnilz can you share a reproducer please? does this happen if you clear the cache manually? |
@nicolas-grekas yes on cache:clear and each request.
|
A service is used at compile time... Can you share the full stack trace please? |
maybe the JMS stuff |
Yes. If I disable JMSSecurityExtraBundle (just for testing) it works again. |
ok, I can reproduce it. |
@nicolas-grekas the proxy-manager uses deterministic proxy properties since Ocramius/ProxyManager#385 but the proxy class name is still random between cache clears. This is because https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/ProxyDumper.php#L105 uses |
With this PR, the generated container is immutable by cache clearing: it doesn't contain any random string anymore (well, third party bundles can add random things back, but at least core doesn't).
Since the class+file name of the container is based on a hash of its content, it means that they are now stable also. This should help fix some edge cases/race conditions during cache clears/rebuilds.
(fabbot failure is false positive)