Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Log status of port before starting server with SelfHostDeployer #993

Merged
merged 2 commits into from
Mar 28, 2017

Conversation

natemcmaster
Copy link
Contributor

I'm trying to make it easier to determine if EADDRINUSE errors in our integration tests are caused because the port truly is in use or because there is some libuv problem binding to addresses.

cref aspnet/Entropy#209

@Tratcher
Copy link
Member

Sample of the output?


private static bool UseNetstat()
{
#if NET46
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 need this?

using System;
using System.Diagnostics;
#if NETSTANDARD1_3
using System.Runtime.InteropServices;
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 need this?

@natemcmaster
Copy link
Contributor Author

macOS with and without port in use

image

Windows with and without port in use

image

{
if (!string.IsNullOrWhiteSpace(data.Data))
{
logger.LogWarning("portstatus: {0}", data.Data);
Copy link
Member

Choose a reason for hiding this comment

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

do you need to set linesLogged here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

stderr would indicate the lsof or netstat command failed to list port info or isn't available on the path.

Copy link
Contributor

@JunTaoLuo JunTaoLuo left a comment

Choose a reason for hiding this comment

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

LGTM.

@natemcmaster natemcmaster merged commit f799044 into dev Mar 28, 2017
@natemcmaster natemcmaster deleted the namc/lsof branch March 28, 2017 17:48
@mikeharder
Copy link
Contributor

mikeharder commented Mar 29, 2017

@natemcmaster: Looks like this is failing in our CI builds:

| ResponseFormats:WebListener:Clr:x64:Portable Warning: Failed to check port status. Executed: cmd /C netstat -nq | find "5087"
|                                                       Error: System.InvalidOperationException: The Process object must have the UseShellExecute property set to false in order to redirect IO streams.
|                                                          at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
|                                                          at System.Diagnostics.Process.Start()
|                                                          at Microsoft.AspNetCore.Server.IntegrationTesting.PortHelper.LogPortStatus(ILogger logger, Int32 port)

It's just a warning but it's noise in the logs

@natemcmaster
Copy link
Contributor Author

I'm going to revert this. It was an attempt to figure out what was causing port conflicts in tests, but it didn't help enough. I think we'll have more success if use dynamic ports.

natemcmaster pushed a commit that referenced this pull request Mar 29, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants