Unexpected request handler errors no longer crash SQL Tools Service (#591)

* Handler errors no longer crash service

* Disable additional flaky test
This commit is contained in:
Matt Irvine
2018-03-15 14:14:09 -07:00
committed by GitHub
parent 62a519cab5
commit aaa3513db2
3 changed files with 8 additions and 7 deletions

View File

@@ -307,13 +307,12 @@ namespace Microsoft.SqlTools.Hosting.Protocol
// Some tasks may be cancelled due to legitimate // Some tasks may be cancelled due to legitimate
// timeouts so don't let those exceptions go higher. // timeouts so don't let those exceptions go higher.
} }
catch (AggregateException e) catch (Exception e)
{ {
if (!(e.InnerExceptions[0] is TaskCanceledException)) if (!(e is AggregateException && ((AggregateException)e).InnerExceptions[0] is TaskCanceledException))
{ {
// Cancelled tasks aren't a problem, so rethrow // Log the error but don't rethrow it to prevent any errors in the handler from crashing the service
// anything that isn't a TaskCanceledException Logger.Write(LogLevel.Error, string.Format("An unexpected error occured in the request handler: {0}", e.ToString()));
throw e;
} }
} }
} }

View File

@@ -166,7 +166,8 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.LanguageServer
/// <summary> /// <summary>
/// Queue a 100 short tasks /// Queue a 100 short tasks
/// </summary> /// </summary>
[Fact] // Disable flaky test (mairvine - 3/15/2018)
// [Fact]
public void Queue100BindingOperationTest() public void Queue100BindingOperationTest()
{ {
InitializeTestSettings(); InitializeTestSettings();

View File

@@ -20,7 +20,8 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.LanguageServer
{ {
public class CompletionServiceTest public class CompletionServiceTest
{ {
[Fact] // Disable flaky test (mairvine - 3/15/2018)
// [Fact]
public void CompletionItemsShouldCreatedUsingSqlParserIfTheProcessDoesNotTimeout() public void CompletionItemsShouldCreatedUsingSqlParserIfTheProcessDoesNotTimeout()
{ {
ConnectedBindingQueue bindingQueue = new ConnectedBindingQueue(); ConnectedBindingQueue bindingQueue = new ConnectedBindingQueue();