-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Do not crash when can't create telemetry mutex. #15574
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently powershell crashes if there's no space on the disk with the following error: ``` Error: failed to execute "pwsh": Process terminated. The type initializer for 'Microsoft.PowerShell.Telemetry.ApplicationInsightsTelemetry' threw an exception. at System.Environment.FailFast(System.String, System.Exception) at Microsoft.PowerShell.UnmanagedPSEntry.Start(System.String[], Int32) at Microsoft.PowerShell.ManagedPSEntry.Main(System.String[]) System.TypeInitializationException: The type initializer for 'Microsoft.PowerShell.Telemetry.ApplicationInsightsTelemetry' threw an exception. ---> System.IO.IOException: The system cannot open the device or file specified. : 'CreateUniqueUserId' at System.Threading.Mutex.CreateMutexCore(Boolean initiallyOwned, String name, Boolean& createdNew) at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name) at Microsoft.PowerShell.Telemetry.ApplicationInsightsTelemetry.GetUniqueIdentifier() in /PowerShell/src/System.Management.Automation/utils/Telemetry.cs:line 802 at Microsoft.PowerShell.Telemetry.ApplicationInsightsTelemetry..cctor() in /PowerShell/src/System.Management.Automation/utils/Telemetry.cs:line 548 --- End of inner exception stack trace --- at Microsoft.PowerShell.Telemetry.ApplicationInsightsTelemetry.SendPSCoreStartupTelemetry(String mode) in /PowerShell/src/System.Management.Automation/utils/Telemetry.cs:line 656 at Microsoft.PowerShell.ConsoleHost.Start(String bannerText, String helpText) in /PowerShell/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs:line 248 at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc) in /PowerShell/src/Microsoft.PowerShell.ConsoleHost/host/msh/ManagedEntrance.cs:line 99 ``` This exception is thrown from Mutex ctor and isn't properly handled. This change fixes it.
0a84be7
to
a1f5b0a
Compare
daxian-dbw
approved these changes
Jun 14, 2021
There was a problem hiding this comment.
Choose a reason f 8000 or hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🎉 Handy links: |
daxian-dbw
pushed a commit
to daxian-dbw/PowerShell
that referenced
this pull request
Oct 13, 2021
daxian-dbw
pushed a commit
to daxian-dbw/PowerShell
that referenced
this pull request
Oct 13, 2021
🎉 Handy links: |
🎉 Handy links: |
22 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Backport-7.0.x-Done
BackPort-7.1.x-Done
Backport to 7.1.x completed
CL-Engine
Indicates that a PR should be marked as an engine change in the Change Log
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
Do not stop powershell when can't create telemetry mutex.
PR Context
Currently powershell crashes on startup if it can't create an instance of
new Mutex
. It might happen if there's no space on the disk, or if the current user doesn't have permissions to the tmp folder.Powershell crashes with the following error:
This exception is thrown from Mutex ctor and isn't properly handled. This change fixes it.
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).