-
Notifications
You must be signed in to change notification settings - Fork 53
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
Conversation
@@ -347,7 +353,8 @@ public class AppRunner | |||
} | |||
} | |||
|
|||
listener.Cancel(); | |||
// TODO: https://github.com/dotnet/xharness/issues/73 | |||
// listener.Cancel(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this 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.
@mandel-macaque I had something like this: 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 |
I merged this so that Egor has something to work with |
This is not a final fix but rather unblock for others.
More information about the hang here:
#73