-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Config] additions from ResourceWatcher #5744
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
…FilteredChilds method
Makes sure that directory and the file resources with the same name will have different ids
file resource existence check shouldn't return true if there's directory with same name instead of file.
* fixed DELETED event when starting to watch a file that does not exist yet * fixed files that are deleted and then re-created Conflicts: src/Symfony/Component/ResourceWatcher/StateChecker/ResourceStateChecker.php tests/Symfony/Tests/Component/ResourceWatcher/StateChecker/DirectoryStateCheckerTest.php tests/Symfony/Tests/Component/ResourceWatcher/StateChecker/FileStateCheckerTest.php
$newestMTime = filemtime($this->resource); | ||
|
||
foreach ($this->getFilteredChilds() as $file) { | ||
clearstatcache(true, (string) $file); |
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.
There are a lot of |
@pborreli renamed |
if ($file->isDir() && '/..' === substr($file, -3)) { | ||
continue; | ||
} | ||
return $this->getModificationTime() < $timestamp; |
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.
Should be <=
?
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.
@Baachi The existing logic is also using <
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.
That's true, but the FileResource
class use <=
.
So i would suggest, that we use <=
here, too.
@Nomack84 the issue is performances, probably due to the fact that |
@stof shouldn't clearstatcache be done either once / instance or if it's a long running process let the user control when he wants to clear it? What do you think? |
I checked out @stof branch tonight. I ran the whole test suite and am trying to figure out how to reproduce this slowness reported from before. Can anyone elaborate on just how much slower this code makes things and how I can see it for myself? As it stands now I'm running the whole test suite and it looks like the time difference is minimal. The current implementation is slower seconds over the course of the entire test suite. That does not sound as dire as I expected, though, so I'm hoping for tips on how to better see the problem. Results from commit 875e0e2 (last commit before this PR)
Current state of this PR
After some minor tweaks
Blindly commenting out the
For a period of time phpunit was leaving a spare php process laying behind. It was using 100% CPU. I was dumped to the prompt normally so I didn't notice it at first. After playing around with various branches for awhile it "just stopped doing it." Does this happen sometimes while running the whole test suite? The problem presented itself by increase in run time... from 3-4 minutes (almost double). While this was a problem, php would stick around regardless of which branch I tried to test of. |
People who reported the slowness were people using the full-stack framework. So, I suppose that testing performance of the standard edition with and without the patch should reveal the performance issue. |
If there's any demo setup that I could use as a base for testing I'll gladly do the debugging/performance analysis of this issue but unfortunately I don't get it what should be installed where and how and so on and I don't really have the patience to read thru all of issues/comments, sorry for being lazy. |
I've took the branch from @stof rebased it against master and put it in a Symfony2 Standard master version with
Thanks to @simensen for getting this up and running. @fabpot where was the slowness reported? Any reproducible test case? The tests aren't showing something spectacular and the Symfony2 Standard edition seems to be running, aside for the above mentioned glitch which I'm not even sure where to start debugging it right now, I'll check in the coming days. It would be a shame to leave this out especially after all the hard work being done for it and the already missed 2.1 release. Let me know how can I further assist on this. My test configuration:
|
This change: https://github.com/symfony/symfony/pull/5744/files#L1L32 causes creation of broken meta file in standard edition, efficiently killing Symfony2. I have no idea why as of yet :/ |
Also this error was a cause of merge revert: #4626. It's a single blocker of this PR and ResourceWatcher as consequence. I'm out of ideas here. |
Oooor. We can revert this particular line back to: $this->resource = realpath($resource); And we're ready to merge. @stof @fabpot what do you think? Update: nevermind. ResourceWatcher ability to track unexisting (yet?) files relies on this change, cuz tracking resource which |
In case if someone interested in bug, here's what's happening when Symfony2 creates cache:
Way to reproduce:
|
Sorry for hopping on this so late. I wasn't aware of ResourceWatcher until recently and was very excited when I learned about it. I am really looking forward to it - great job @everzet and all involved! Regarding this particular PR and changes to the Config/ResourceInterface, I'd like to voice some concerns though. I think this PR blends changes that are necessary to support "ResourceWatching" into an interface that has a different purpose right now. This violates the segregated interface principle. I tried to explain what ResourceInterface currently is (and IMHO should be even more clearly) in issue #7176 . In particular
I do not say that there could not be an implementation of a "filesystem file thing" or "directory thing" (avoiding "Resource" here) that supports both ResourceInterface (for ConfigCache'ing) and ResourceWatch'ing, but I think both are different concerns and should be handled as such. Whether such an implementation should be in the Config component is yet another question. ConfigCache might be used with more general types of Resources (as of Loaders, they even support loading from Closures). I don't think is feasible to use this general notion of "Resources" for ResourceWatching though (at least not in all cases). The one link I see between ResourceWatcher and ConfigCache is the idea of using the former to watch and expunge the cache of the latter, but I don't know how that could happen during a regular (HTTP) kernel request at all. |
Closing this PR. The new features added in the ResourceInterface are breaking BC and are not needed anymore as the ResourceWatcher component won't be merged in favor of https://github.com/henrikbjorn/Lurker shipping the code standalone |
This is the reopened (and rebased) version of #4619 which was reverted for 2.1
It is required by #4605