Skip to content
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

Add shutdown argument to VBCSCompiler #7930

Merged
merged 9 commits into from
Jan 19, 2016
Merged

Conversation

jaredpar
Copy link
Member

This adds a -shutdown argument to VBCSCompiler that allows clients to gracefully shutdown the server. This is implemented by adding a new message to the protocol which does two actions:

  • Begins a shut down of the server.
  • Returns the process id of the server to the client who initiated the shutdown.

When reviewing the changes to ServerDispatcher it's important to understand the difference between the following operations:

  • Shutting down: The server will accept no new build requests but will allow previously scheduled ones to complete without interruption. While these builds are finishing up the server will continue to respond to shutdown requests with the process id.
  • Cancelling: This happens when the CancellationToken passed into the server is signaled. In this case the server will cancel all previously scheduled build requests and accept no new connections. In other words, cancel as fast as possible.

closes #7115

CC @dotnet/roslyn-compiler

@jaredpar
Copy link
Member Author

retest please

@davkean
Copy link
Member

davkean commented Jan 13, 2016

@dotnet-bot retest prtest/lin/dbg/unit32 please
// Previous failure: http://dotnet-ci.cloudapp.net/job/roslyn_prtest_lin_dbg_unit32/2713/
// Retest reason: Build break

@agocke
Copy link
Member

agocke commented Jan 14, 2016

What's the motivation here?

@jaredpar
Copy link
Member Author

@agocke there were an increasing number of scenarios where we wanted to shutdown a specific compiler server gracefully without waiting for the timeout to expire. Typically in order to get it to release references to the compiler DLLs. The scenarios we had hit:

  • The Jenkins build scripts
  • NuGet operations
  • Roslyn VSIX install / uninstall

Killing all VBCSCompiler instances, while safe, is a bit hacky. Having a definitive shutdown seemed like a much more palatable option.

@@ -268,7 +256,9 @@ public enum ResponseType
{
MismatchedVersion,
Completed,
AnalyzerInconsistency
AnalyzerInconsistency,
Shutdown,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does response Shutdown mean?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think members of this enum deserve good comments.

@AlekseyTs
Copy link
Contributor

LGTM

1 similar comment
@VSadov
Copy link
Member

VSadov commented Jan 15, 2016

LGTM

jaredpar and others added 9 commits January 18, 2016 21:19
Cleaned up a couple of small style issues.
Extends the build server protocol to support requests to shut down the
server.  The response is the ID of the server process the caller can
wait on for completion.
Added a test to verify the shutdown operation is passive.  If any
existing compilations are in progress they will be allowed to complete
after the shutdown is received.

This required a bit of code refactoring.  It needed to be easier to
intercept compilation requests and block on them until a given set of
events had completed.
This changes the server to respond to shutdown requests through the
entire lifetime of the server.  This means even in a shutting down state
it will still respond to clients with a process id.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vbcscompiler.exe should support a /shutdown flag
6 participants