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

Fix EndToEndTestHelper to read input and error streams only after process exits #129

Merged
merged 1 commit into from
May 11, 2019

Conversation

kichalla
Copy link
Contributor

No description provided.

@kichalla kichalla requested a review from a team as a code owner May 10, 2019 18:37
@@ -255,6 +221,12 @@ public static class EndToEndTestHelper
{
// Stop the container so that shared resources (like ports) are disposed.
dockerCli.StopContainer(runResult.ContainerName);

// Access the output and error streams after the process has exited
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This solution is different from what I mentioned to you yesterday because even in the scenario where the caller supplies the builders for stdout or stderr streams, the caller still needs to read the builders only after the process no longer writes to them to prevent the exception that we are seeing, so instead of changing the method contract, I just changed this method to make sure to read the output at a point which is safe.


for (var i = 0; i < MaxRetryCount; i++)
{
await Task.Delay(TimeSpan.FromSeconds(DelayBetweenRetriesInSeconds));

try
{
// Make sure the process is still alive and fail fast if not alive.
await RunAssertsAsync(
Copy link
Member

Choose a reason for hiding this comment

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

do we still need this method? If yes, doesn't it have the same problem?

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 use this method for the scenario when doing a 'build' where we kick off a process and wait for it to exit and write out the output when asserts fail. Since the process already exits, we do not have an issue here.

@kichalla kichalla merged commit fb02124 into master May 11, 2019
@kichalla kichalla deleted the kichalla/fix.stringbuilder.threading.issue branch May 11, 2019 12:47
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