-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Container is sometimes being rebuilt on every request even though nothing changed #227
Comments
These concurrent things are really mindblowing. Just thinking… Could the cache play a role in this? Can you try call |
Not really, I'm afraid. After dev machine reboot and disabling xdebug, the container rebuild time is about 50ms and it is being rebuilt on about every second reload. |
I am not sure if it's a best solution but these problems are related to https://github.com/nette/application/blob/master/src/Bridges/ApplicationDI/PresenterFactoryCallback.php#L47 and https://github.com/nette/application/blob/master/src/Bridges/ApplicationDI/ApplicationExtension.php#L152 PresenterFactoryCallback could not find presenter registered as a service and it triggers container rebuild, so you may have automatic registration of presenters misconfigured. |
@mabar You are probably right, yet I don't use any custom presenters registration - yes, presenters with scalar dependencies are registered manually in services config, but nothing custom apart from that. |
Btw in the next bigger release I would like to move on to something like modette PresenterFactoryCallback and get rid of the dynamic creation of presenters. |
Manual registration is totally ok, I have it as a enforced requirement. Problematic is autodiscovery - you may just forgot to add folder with your presenters to scanDirs. Or if you have scanComposer enabled then be aware of fact it can find only classes from classmap - PSR-4 namespaces are not searched |
@dg ❤️ Glad to hear it |
Presenters are loaded with robotLoader. Is simple robotloader configuration not enough? No scanDirs directive set, but looking to the source, scanDirs just sets the robotloader the same way. |
No, because compiler has not access to RobotLoader, it must be configured via scanDirs. |
Is that documented? When I remove
|
Oh, keeping both bootstrap robotLoader and scanDirs fixes this. Couldn't this be easier? Will incorporating something like modette PresenterFactoryCallback solve this? |
I tried to modify it to use an external robotloader. |
Version:
Bug Description
According to Tracy Bar, the application sometimes falls to a state when the container is being rebuilt on every request.
This is a result of the condition
$files !== $currentFiles
inDependencyChecker::isExpired
call being true. All compared files are equal except fortemp/cache/nette.application/touch
timestamp of which differs for about 2 seconds.Steps To Reproduce
n/a. Unfortunately, this comes and goes and I haven't yet discovered the exact cause.
Expected Behavior
The container is being rebuit only when something actually changed.
Possible Solution
Compilation of the container takes about 500-1500 ms based on Tracy panel. Maybe the timestamps are saved on opposite sides of the compilation and therefore the difference?
The text was updated successfully, but these errors were encountered: