-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix Razor server shutdown on Windows. #9160
Fix Razor server shutdown on Windows. #9160
Conversation
@MattGertz for approval (RTM) Issues fixed#9158 Description of IssueFollowing a manual test pass on the Customer ImpactIf the customer has a running Razor server when executing RiskLow - the fix is to change the TestingThe bug was not caught by automated tests because an integration test was not able to be implemented in time for RC due to being a cross-team feature. Additionally, the developer (me) did not test Razor shut down on Windows, only on macOS and Linux. This PR implements an integration test that would have caught this failure. Manual tests were also run on macOS, Linux, and Windows to validate the change. |
OK to take to .NET Core Shiproom. |
} | ||
catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException) | ||
{ | ||
// Any failure to read the file will ignore the file |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
It looks like the integration test potentially interfered with another CI process that was running a Razor server. I'm going to have to think about how to isolate this or disable the test. |
string.Format( | ||
LocalizableStrings.ShutDownSucceededWithPid, | ||
CommandLocalizableStrings.RazorServer, | ||
@"\d+").Replace("(", @"\(").Replace(")", @"\)")); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
On Windows, the Razor server correctly creates the pid file with `FileAccess.Write` and `FileOptions.DeleteOnClose`. This requires a share mode of `FileShare.Write | FileShare.Delete` to open. However, the `dotnet build-server shutdown` command was opening the file with `FileShare.Read`. As a result, an `IOException` was being thrown and was not handled. This change first opens the file with the appropriate share access and also properly handles a failure to access or read the contents of the pid file. Additionally, an integration test was added to test that Razor server shutdown works as expected. Fixes #9158.
Okay, pushed up a fix for the integration test. The Razor server now uses a unique pipe name and pid file directory, which should effectively isolate it from any other CI process. |
On Windows, the Razor server correctly creates the pid file with
FileAccess.Write
andFileOptions.DeleteOnClose
. This requires a share modeof
FileShare.Write | FileShare.Delete
to open. However, thedotnet build-server shutdown
command was opening the file withFileShare.Read
. As a result, anIOException
was being thrown and was nothandled.
This change first opens the file with the appropriate share access and also
properly handles a failure to access or read the contents of the pid file.
Additionally, an integration test was added to test that Razor server shutdown
works as expected.
Fixes #9158.