-
Notifications
You must be signed in to change notification settings - Fork 905
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
".registry.bad" files are created for actually valid registry snapshots #1581
Comments
extends GH-1580 |
until this is fixed, following snipped may help fixing those invalid created files:
|
`I've been having problems with corrupted chocolatey.config files in the past, because choco.exe is run quite often (and hence sometimes simultaneously) in my environment This is one of the reasons why I created chocolatey-preinstaller-checks.extension which is currently on forced hold and being needlessly debated. |
Just another comment, I brought up this issue and started experimenting/triaging it as well, unfortunately the conversation got no results. https://groups.google.com/forum/#!topic/chocolatey/IaQ7_vLX-3s The follow snippet was the weirdest of the behaviors:
|
@bcurran3 - I'm really thinking that there could be a synchronization issue going on here, the thing is .. I can't really get it to reproduce by 'forcing it' - with the corrupt chocolatey.config it's been easy - spin up 1000x "choco list -o" simultaneously (via PowerShell Jobs) - BOOM broken config file.
But this (forcing it into a wrong behavior) doesn't seem to be possible with the .registry.bad files... |
Luckily this problem has gone away for me. I'm not sure why. I'd like to say https://chocolatey.org/packages/chocolatey-preinstaller-checks.extension (BTW: there's a new configurable 0.0.2 up on my GitHub repo) fixed the problem for me, but I have no proof. I do know my Chocolatey Pro license expired 05/25/2018. So that's an obvious change in my environment. I could hypothesize that it's related, but have no way to prove/test/etc without buying a new Pro license. So it's just a theory. Out of curiosity are you running a paid version of Chocolatey? I see the Customer tag on this issue, I'm assuming you are. We might be narrowing the problem down... EDIT: v0.0.2.1 is current: https://chocolatey.org/packages/chocolatey-preinstaller-checks.extension |
I am sometimes seeing this issue and getting it fixed with the oneliner (#1581 (comment)) and I am using the open source edition judging by the pricing page and not having paid anything. |
uh, thanks @Mikaela - than this is clearly not caused by utilizing licensed choco features. |
You're welcome. I should probably add some additional information in case it turns out to be relevant. I am using Windows 10 Insider Slow ring, but have seen this on family PC running stable branch. I also have https://chocolatey.org/packages/choco-upgrade-all-at-startup installed as I don't trust my family to run Chocolatey or GUI and I guess it's possible that it is attempting to run simultaneously when I run Choco by hand as I have funny habit of checking updates with package managers as soon as I boot machines. |
If you're running a choco command while a choco upgrade all is going on....you're bound to have problems. It's not supported and well documented that you'll have problems. It's on the Chocolatey 1.0 milestone list to be fixed. Make sure you read my summary of known issues at: The first link in the thread above will default to the -pre release. The 0.0.1 release (still being ignored and in moderation purgatory) has a MUCH more detailed description of the problems and links to the GitHub choco issues. I'd recommend you try the 0.0.2 pre-release (same but configurable) from my GitHub rep: FYI: You'll have to manually install it. (Download .nupkg, cinst name of .nupkg) EDIT: v0.0.2.1 is current: https://chocolatey.org/packages/chocolatey-preinstaller-checks.extension |
So I think I know what may be going on here, but I'm not sure and want to add some logging for 0.10.12 release to see if it brings the issue to light. |
So here is my theory, There is a try that decides if the xml file should be renamed to .bad done at choco/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs Line 98 in 4db2e04
Once it fails attempting to read the file, it renames it to .bad. This is at choco/src/chocolatey/infrastructure.app/services/ChocolateyPackageInformationService.cs Lines 101 to 116 in 4db2e04
But as you dig into the code, you realize there are several factors that could cause an error with a perfectly valid .registry file. For one, it only attempts to deserialize the file one time. choco/src/chocolatey/infrastructure.app/services/RegistryService.cs Lines 390 to 398 in 4db2e04
What kinds of errors can we see from that code?
So if there is a lock on the file that doesn't let go in time, boom, renamed to bad registry file. To start with, you can search your logs for when you get the warning about the registry and see if right before that the mutex threw a timeout. Something like: I'm going to add some more logging around exactly when we decide to move the file and log the error so it's more explicit into why this is done. Probably the right answer here is to look at using GlobalMutex with a guid per file we are accessing, so things can move faster and synchronize across faster. This is trickier as we need to be able to uniquely set a GUID per file AND the same GUID per file each time. |
Add reference to documentation on Escape, remove variable, and fix possible null reference exception with a conversion "to_string()" after the Escape method.
Previously, the attempt to deserialize a file was only run once. This should be attempted at least twice to ensure that it can be a bit more robust in the check.
Previously, when a .registry file was moved to .registry.bad, there wasn't an indication of what all might have caused it to be set that way. Provide some logging based on exactly what causes it, and provide the entire error output instead of just the message for now.
So we've added more logging and tolerance around this for 0.10.12. |
If not already done, please check to see if the .registry file is already open during processing. |
@bcurran3 that's already done. |
@mwallner has this happened since we put in the fix for 0.10.12? |
I haven't heard any grumbles of this occurring anywhere else, so the fault tolerance change up for multiple tries probably fixed the issue. Marking as resolved for 0.10.14, but will note in release notes this actually went in at 0.10.12. |
not seeing this issue anymore (yet we're already on 0.10.15 ...) |
I got the warning that this registry snapshot is broken:
After renaming the file from
.registry.bad
to.registry
and re-ranchoco info
the emmitted warning disappeared. (which would suggest the file is actually ok)Related to #1505 and #1540
The text was updated successfully, but these errors were encountered: