SkyAPM-dotnet icon indicating copy to clipboard operation
SkyAPM-dotnet copied to clipboard

A large number of httpclients and tcp are created when the oap server is unavailable

Open saber-wang opened this issue 2 years ago • 4 comments

Please answer these questions before submitting your issue.

  • Why do you submit this issue?
  • [ ] Question or discussion
  • [x] Bug
  • [ ] Requirement
  • [ ] Feature or performance improvement

Bug

Here's the problem:

https://github.com/SkyAPM/SkyAPM-dotnet/blob/7e7693dd7ad692f2e52037232dc741dad6a71cd4/src/SkyApm.Transport.Grpc/ConnectionManager.cs#L58-L61

It is executed every 15 seconds. At this time, it is offline and the GrpcChannel is recreated. Each time the GrpcChannel is created, a new httpclient instance will be created.

Optional fixes:

Provide your own httpclient for GrpcChannel and reuse httpclient instances.

In addition, ShutdownAsync does not seem to be implemented? image

saber-wang avatar Feb 22 '23 03:02 saber-wang

@liuhaoyang There is a repair plan?

saber-wang avatar Mar 14 '23 01:03 saber-wang

@liuhaoyang
I tried to process and found that the httpclient created when based on netstandard 2.0 is not available. If I reuse it directly_ Channel doesn't seem to be rebuilding Tongtong.

我尝试处理发现在基于netstandard2.0时创建的httpclient不可用,如果直接复用_channel 似乎不会重建通通。

saber-wang avatar Mar 21 '23 03:03 saber-wang

@liuhaoyang I tried to process and found that the httpclient created when based on netstandard 2.0 is not available. If I reuse it directly_ Channel doesn't seem to be rebuilding Tongtong.

我尝试处理发现在基于netstandard2.0时创建的httpclient不可用,如果直接复用_channel 似乎不会重建通通。

It may be better to release the old connection completely when retrying the gRPC connection

liuhaoyang avatar Mar 21 '23 03:03 liuhaoyang

@liuhaoyang 请问这个问题解决了嘛?(oap服务挂掉后会创建大量httpclient、tcp连接)🙏

2741823826GX avatar Jun 25 '24 08:06 2741823826GX