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

Porting fix for Design mode clients hang for errors #1451

Merged
merged 6 commits into from
Mar 16, 2018

Conversation

abhishkk
Copy link
Contributor

@abhishkk abhishkk commented Feb 26, 2018

There are few error scenarios in which we were not sending discovery/run completion event and thus causing Design mode to hang.

In this fix, sending discovery complete for those scenarios.

15.6 PR: #1444

@abhishkk abhishkk changed the title Fix: Design mode clients hang for errors Porting fix for Design mode clients hang for errors Feb 26, 2018
this.LogMessage(TestMessageLevel.Error, exception.ToString());

// Send a run complete to caller. Similar logic is also used in ParallelProxyExecutionManager.StartTestRunOnConcurrentManager
// Aborted is `true`: in case of parallel run (or non shared host), an aborted message ensures another execution manager
// created to replace the current one. This will help if the current execution manager is aborted due to irreparable error
// and the test host is lost as well.
var completeArgs = new TestRunCompleteEventArgs(null, false, true, exception, new Collection<AttachmentSet>(), TimeSpan.Zero);
var completeArgs = new TestRunCompleteEventArgs(null, false, true, null, new Collection<AttachmentSet>(), TimeSpan.Zero);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are not sending exception in TestRunCompleteEvent here to avoid duplicacy. (as we are sending error as separate message.)

this.LogMessage(TestMessageLevel.Error, exception.ToString());

// Send a run complete to caller. Similar logic is also used in ParallelProxyExecutionManager.StartTestRunOnConcurrentManager
// Aborted is `true`: in case of parallel run (or non shared host), an aborted message ensures another execution manager
// created to replace the current one. This will help if the current execution manager is aborted due to irreparable error
// and the test host is lost as well.
var completeArgs = new TestRunCompleteEventArgs(null, false, true, exception, new Collection<AttachmentSet>(), TimeSpan.Zero);
var completeArgs = new TestRunCompleteEventArgs(null, false, true, null, new Collection<AttachmentSet>(), TimeSpan.Zero);
var testRunCompletePayload = new TestRunCompletePayload { TestRunCompleteArgs = completeArgs };
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this change is IDE behavior? What if IDE was displaying some warning if it receives Exception in TestRunComplete.
I'm not saying that this change is not correct, but can me sure IDE honors it as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are sending TestMessage of error which IDE will show as error. After that we don't need to send exception in TestRunComplete. This change is done for IDE only as IDE was showing error twice in this case, once because of TestMessage of error. and second because of exception in TestRunComplete.

// Send discovery complete. Similar logic is also used in ProxyDiscoveryManager.DiscoverTests.
// Differences:
// Total tests must be zero here since parallel discovery events handler adds the count
// Keep `lastChunk` as null since we don't want a message back to the IDE (discovery didn't even begin)
// Set `isAborted` as true since we want this instance of discovery manager to be replaced
var discoveryCompleteEventsArgs = new DiscoveryCompleteEventArgs(-1, true);

this.GetHandlerForGivenManager(proxyDiscoveryManager).HandleDiscoveryComplete(discoveryCompleteEventsArgs, null);
handler.HandleDiscoveryComplete(discoveryCompleteEventsArgs, null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the handler's "HandleDiscoveryComplete" calls HandRawMessage for discovery complete?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. we don't need to send handleRawMessage of complete in case of parallel as handleRawMessage is sent itself by parallel discovery manager when all managers completes discovery.

// Send a run complete to caller. Similar logic is also used in ProxyExecutionManager.StartTestRun
// Differences:
// Aborted is sent to allow the current execution manager replaced with another instance
// Ensure that the test run aggregator in parallel run events handler doesn't add these statistics
// (since the test run didn't even start)
var completeArgs = new TestRunCompleteEventArgs(null, false, true, null, new Collection<AttachmentSet>(), TimeSpan.Zero);
this.GetHandlerForGivenManager(proxyExecutionManager).HandleTestRunComplete(completeArgs, null, null, null);
handler.HandleTestRunComplete(completeArgs, null, null, null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as in parallel discovery

@abhishkk abhishkk merged commit 3391a4c into microsoft:master Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants