-
Notifications
You must be signed in to change notification settings - Fork 909
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
Running Chocolatey CLI with an expired Chocolatey License can result in non-commercial commands failing to run #2289
Comments
This could just need new Rhino.Licensing. The fix was in there IIRC. |
So I've been able to reproduce this issue with the following steps:
To make it a little easier to test, I've created a gist: https://gist.github.com/5d21047ad9aef5367b953a88db8d9990 You can test with the gist by running the following (this assumes you have both Chocolatey and git installed): git clone https://gist.github.com/5d21047ad9aef5367b953a88db8d9990.git
cd 5d21047ad9aef5367b953a88db8d9990
choco pack .\test.nuspec
choco pack .\test2.nuspec
[xml]$a = gc C:\programdata\Chocolatey\license\chocolatey.license.xml
Set-TimeZone -Id UTC
set-date (get-date $a.license.expiration).AddMinutes(-3)
choco install test2 -s . -y Of particular interest is that this After getting |
I'm not able to update Rhino.Licensing to the latest we have internally as it's built on framework 4.8, dotnet standard 2, and dotnet core 3 so trying to reference it fails to build. I have been able to trace the code to this pipeline.Invoke(): https://github.com/chocolatey/choco/blob/master/src/chocolatey/infrastructure.app/services/PowershellService.cs#L635 But then sometime while it's running, it seems the Rhino.Licensing license check Task returns and throws an exception. Looking at the source for Rhino.Licensing, it looks like the disabling of the license check is in there, but I can't tell if it's actually being set properly. |
Ok, this has taken some digging, but basically what appears to be happening: When we do a license check, Rhino.Licensing sets a timer that fires every 5 minutes to revalidate the license. We attempt to disable the future license checks, but it's not guaranteed to happen. Further to that, when the license is expired, Rhino.Licensing throws an Invalid License Exception before it disables the check, so the timer is still active and throws an exception when it fires next. So when we first start up, we check the license. Rhino.Licensing sets the license check timer, then it checks if the license is valid. When the license is invalid because it's expired it throws an exception, but leaves the timer active. If whatever task Chocolatey is doing takes longer than 5 minutes it will encounter an unhandled exception coming from Rhino.Licensing. Based on this, I'll open an issue in https://github.com/chocolatey/rhino-licensing to address both the potential that the timer doesn't get removed, and that the exception is thrown before disabling the timer. Once the issue is created I'll update this issue so they can be linked together. |
Issue 4 opened on Rhino.Licensing repository. |
Update to v1.4.1 of Rhino.Licensing to resolve the issue where a timer crashes the application when an invalid license is detected after 5 minutes of running, due to the timer not being properly disabled and disposed when requested.
Update to v1.4.1 of Rhino.Licensing to resolve the issue where a timer crashes the application when an invalid license is detected after 5 minutes of running, due to the timer not being properly disabled and disposed when requested.
Added back in the acknowledgements and license files. It is important that these continue to come along for the ride.
(#2289) Update Rhino.Licensing dependency
Update to v1.4.1 of Rhino.Licensing to resolve the issue where a timer crashes the application when an invalid license is detected after 5 minutes of running, due to the timer not being properly disabled and disposed when requested.
Added back in the acknowledgements and license files. It is important that these continue to come along for the ride.
Update to v1.4.1 of Rhino.Licensing to resolve the issue where a timer crashes the application when an invalid license is detected after 5 minutes of running, due to the timer not being properly disabled and disposed when requested.
Added back in the acknowledgements and license files. It is important that these continue to come along for the ride.
* hotfix/0.11.3: (version) 0.11.3-beta (maint) Prevent inclusion of snk file (#2336) Remove quotes from InstallLocation (#877) Set SourceType for packages parsed from config (#2289) Add acknowledgements and license files (#2289) Update Rhino.Licensing dependency (maint) Replace unversioned Rhino.Licensing dll (#2398) Restore PowerShell v2 support (#2412) Switch to output warning on failure
* master: (version) 0.11.3 (version) 0.11.3-beta (maint) Prevent inclusion of snk file (#2336) Remove quotes from InstallLocation (#877) Set SourceType for packages parsed from config (#2289) Add acknowledgements and license files (#2289) Update Rhino.Licensing dependency (maint) Replace unversioned Rhino.Licensing dll (#2398) Restore PowerShell v2 support (#2412) Switch to output warning on failure # Conflicts: # .uppercut
What You Are Seeing?
If you're running a licensed edition, and your license expires it is expected that Chocolatey falls back to FOSS operational mode. We raised and fixed this issue in #1500, but it looks like we need to backport some of that work into the open source codebase.
What is Expected?
An expired license should not prevent
choco install
etc to failThe text was updated successfully, but these errors were encountered: