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

macos 14.1 HttpClient Error: System.IO.IOException: Unable to write data to the transport connection: Broken pipe #1412

Open
ty793941 opened this issue Oct 29, 2023 · 1 comment

Comments

@ty793941
Copy link

ty793941 commented Oct 29, 2023

operating system: macos 14.1 sonama
dotnet : 7.0.2

Error Code:

HttpClient httpClient = new HttpClient();
try
{
    var s = httpClient.GetAsync("http://www.baidu.com").Result;
}
catch (Exception ex)
{
    Console.WriteLine(ex.ToString());
}

The Exception:

   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at System.Net.Http.HttpConnectionPool.HttpConnectionWaiter`1.WaitForConnectionAsync(Boolean async, CancellationToken requestCancellationToken)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext()
   at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(IAsyncStateMachineBox box, Boolean allowInlining)
   at System.Threading.Tasks.Task.RunContinuations(Object continuationObject)
   at System.Threading.Tasks.Task`1.TrySetResult(TResult result)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetExistingTaskResult(Task`1 task, TResult result)
   at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecutionContextCallback(Object s)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.MoveNext(Thread threadPoolThread)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.AsyncStateMachineBox`1.ExecuteFromThreadPool(Thread threadPoolThread)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()
--- End of stack trace from previous location ---

When I haven't upgraded to macos 14.1,everything is ok,But when I upgraded to macos 14.1, all the HttpClient is error with the same exception 。

I create the new project,it‘s the same exception。

Please help me!

image
@ty793941
Copy link
Author

ty793941 commented Oct 29, 2023

i found two:

  1. I has used the VPN,influenced me。Then close VPN:
    //it's working.
    var s = await httpClient.GetAsync("http://www.baidu.com");

    //it's working.
    var s1 = httpClient.GetAsync("http://localhost:8001/home/getenv").Result;

   //it's report the exception
   var s1 = httpClient.GetAsync("http://127.0.0.1:8001/home/getenv").Result;
  1. Based on the above,I found the "localhost:8001" is ok, and the "127.0.0.1:8001" is not work.

And it maybe not the dotnet issue.

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

No branches or pull requests

1 participant