Repository navigation
Closed
Labels
Execution-ModuleP3Priority 3PlatformRelates to OS, containers, platform-based utilities like FS, system based appsWindowsseverity-criticaltop severity, seen by most users, serious issues
Milestone
Description
Description of Issue/Question
On the carbon branch and develop a pkg.refresh_db() is executed for every single instance of pkg.installed that is found when applying an sls file or a highstate.
Setup
Install Salt from the carbon branch on Windows. I believe this would happen on develop, as well.
Steps to Reproduce Issue
cat /srv/salt/winstates.sls
filezilla:
pkg.installed
#pidgin:
#pkg.installed
#vlc:
#pkg.installed
#ccleaner:
#pkg.installed
I start out with all but one pkg.installed commented out. Then I run the highstate with test=True and I see the repo get refreshed on the minion once. Each time I uncomment another state roughly another minute is added to the total run time and an extra pkg.refresh_db() is executed.
root@bouchamaster:/srv/salt# time salt davewintest state.highstate test=True
davewintest:
Name: filezilla - Function: pkg.installed - Result: Differs Started: - 12:38:25.715000 Duration: 78407.0 ms
Summary for davewintest
------------
Succeeded: 1 (unchanged=1)
Failed: 0
------------
Total states run: 1
Total run time: 78.407 s
real 1m34.114s
user 0m1.825s
sys 0m0.216s
root@bouchamaster:/srv/salt# time salt davewintest state.highstate test=True
davewintest:
Name: filezilla - Function: pkg.installed - Result: Differs Started: - 12:40:15.642000 Duration: 60409.0 ms
Name: pidgin - Function: pkg.installed - Result: Differs Started: - 12:41:16.051000 Duration: 61219.0 ms
Summary for davewintest
------------
Succeeded: 2 (unchanged=2)
Failed: 0
------------
Total states run: 2
Total run time: 121.628 s
real 2m27.577s
user 0m2.828s
sys 0m0.328s
root@bouchamaster:/srv/salt# time salt davewintest state.highstate test=True
davewintest:
Name: filezilla - Function: pkg.installed - Result: Differs Started: - 12:43:11.962000 Duration: 62046.0 ms
Name: pidgin - Function: pkg.installed - Result: Differs Started: - 12:44:14.008000 Duration: 61608.0 ms
Name: vlc - Function: pkg.installed - Result: Differs Started: - 12:45:15.616000 Duration: 61000.0 ms
Summary for davewintest
------------
Succeeded: 3 (unchanged=3)
Failed: 0
------------
Total states run: 3
Total run time: 184.654 s
real 3m28.154s
user 0m3.999s
sys 0m0.342s
root@bouchamaster:/srv/salt# time salt davewintest state.highstate test=True
davewintest:
Name: filezilla - Function: pkg.installed - Result: Differs Started: - 14:49:33.975000 Duration: 65417.0 ms
Name: pidgin - Function: pkg.installed - Result: Differs Started: - 14:50:39.392000 Duration: 63028.0 ms
Name: vlc - Function: pkg.installed - Result: Differs Started: - 14:51:42.420000 Duration: 62997.0 ms
Name: ccleaner - Function: pkg.installed - Result: Differs Started: - 14:52:45.417000 Duration: 63372.0 ms
Summary for davewintest
------------
Succeeded: 4 (unchanged=4)
Failed: 0
------------
Total states run: 4
Total run time: 254.814 s
real 4m43.106s
user 0m5.344s
sys 0m0.468s
Versions Report
Carbon
Metadata
Metadata
Assignees
Labels
Execution-ModuleP3Priority 3PlatformRelates to OS, containers, platform-based utilities like FS, system based appsWindowsseverity-criticaltop severity, seen by most users, serious issues
Activity
UtahDave commentedon Sep 7, 2016
@damon-atkins, could you take a look at this, too? I think this may have been affected by the updates you made to the refresh_db function on the win_pkg.py file. I haven't completely figured out the solution yet, but I think we need to let the pkg state decide when to do the refresh_db and not have the win_pkg try to be too clever.
damon-atkins commentedon Sep 8, 2016
See #36088 comments on state/pkg.py This has existing since version 0.11 of salt.
I can have a look at it.... I don't want it slow. But I was not prepared to change too much of how salt currently works i.e. state/pkg.py which request the refresh_db because its an expected behavior.
UtahDave commentedon Sep 8, 2016
No, that is not true. This is not just updating the cache once per highstate in the init() function. A refresh is now happening for EVERY pkg.installed call wherever they are in the highstate. Salt has never done that. Salt has never done that on Windows. I wrote the Salt package manager for Windows.
damon-atkins commentedon Sep 8, 2016
Hi @UtahDave I do not think I have introduced this issue, I think its existed for a long time. The issues is with state/pkg.py can not see how removing two lines of import and namespace would cause this in pkg.py.
Anyway we both don't want refresh happen needlessly.
But I will double check I have not caused it in win_pkg.py because that's the last thing I want to do is introduce issues.
And this will show the pre and post behavior change.
Then we can work out a plan to fix it... assuming it is coming from state/pkg.py. Otherwise I will just fix it if its in modules/win_pkg.py
damon-atkins commentedon Sep 8, 2016
Here is the result of 2016.3 test (test_win_pkg contains the same as above)
Note my logging is setup differently to the default settings.
As you can see we get the wrong behavior, i.e. refresh is called 4 times instead of once
Now the same thing but with "latest". As you can see we get the expected behavior i.e. refresh is called once
from list_pkgs, therefore states/pkg.py is calling this with refresh=True and therefore is the root cause
damon-atkins commentedon Sep 9, 2016
See also PR #34768 2015.8 Aug 2 - Makes sure that pkg.installed works in accordance with the docs when it comes to refreshing the pkg db in Windows. Even if, for some reason, it's not a perfect fix it will only improve things, and it shouldn't break anything non-Windows
damon-atkins commentedon Sep 13, 2016
At the end of the run the refresh file should not exist
damon-atkins commentedon Sep 13, 2016
Diffs link here remove as out of date
damon-atkins commentedon Sep 13, 2016
Diffs link here remove as out of date
UtahDave commentedon Sep 13, 2016
#36222 seems to fix this bug.
damon-atkins commentedon Sep 27, 2016
As part of #36222 which included
states/pkg.py Fixes
This should resolve this issue for Carbon going forward. Previous release will need this fix i.e. _refresh_tag_file() changes in states/pkg.py