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

Prevent hang of XHarness when Listener doesn't initialize fully #74

Merged
merged 2 commits into from
Apr 23, 2020

Conversation

premun
Copy link
Member

@premun premun commented Apr 23, 2020

This is not a final fix but rather unblock for others.

More information about the hang here:
#73

@premun premun added the apple iOS/tvOS/WatchOS/Mac Catalyst area label Apr 23, 2020
@@ -347,7 +353,8 @@ public class AppRunner
}
}

listener.Cancel();
// TODO: https://github.com/dotnet/xharness/issues/73
// listener.Cancel();
Copy link
Member

Choose a reason for hiding this comment

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

Hmm that is annoying. Crazy question, have you tried something int the listener.Cancel to instead of calling the Cancel of the TcpListener to access the Socket and close it? Something like:

server.Server.Close();

Is a little brute but might work.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, will give it a go

Copy link
Member

@mandel-macaque mandel-macaque left a comment

Choose a reason for hiding this comment

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

Overall adding the cancellation token is a good idea, even if we are talking about a workaround. Please look at my comment, we might be able to call the socket close method directly.

@premun
Copy link
Member Author

premun commented Apr 23, 2020

@mandel-macaque I had something like this:
premun@572007c

But then I realized the timeout actually works, just the hang is after. I am also thinking of not setting any timeout inside the AppRunner and controlling it through cancellationToken from the CLI

@premun premun merged commit 9bd8fd6 into dotnet:master Apr 23, 2020
@premun premun deleted the prvysoky/timeouts branch April 23, 2020 14:13
@premun
Copy link
Member Author

premun commented Apr 23, 2020

I merged this so that Egor has something to work with

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apple iOS/tvOS/WatchOS/Mac Catalyst area
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants