Nick-The-Uncharted opened a new issue, #3025:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3025
## 复现代码:
microservice.yaml
```yaml
servicecomb:
executor:
default:
group: 1
coreThreads-per-group: 0
maxThreads-per-group: 1
maxIdleSecond-per-group: 1
```
controller:
```java
@RpcReference(microserviceName = "xxx", schemaId = "xxx")
protected XXXProxy xxxProxy;
@GetMapping("/test")
public void test(){
otaTaskOperateProxy.collectLog("asd", "sd").whenComplete((d, e) ->
otaTaskOperateProxy.collectLog("a", "b"));
}
```
每隔1s发送一次请求,就会发现org.apache.servicecomb.foundation.vertx.client.ClientPoolManager#pools一直在增长。
由于HttpClient里有证书相关的信息,贼大(几百k),很快就把内存占满,引发疯狂fullGC
## 分析:
*
test接口第一次发送请求io.vertx.core.http.impl.HttpClientImpl#request(io.vertx.core.http.RequestOptions)
时由于当前线程是类似"group0-1-thread-2"@19,463 in group "main": RUNNING 的线程
没有context所以io.vertx.core.impl.VertxImpl#getOrCreateContext新建了context,
类似这样的线程默认一共有25(core)~100(max)个
* 请求的响应使用的context就为第一步新建的context,
io.vertx.core.impl.future.FutureBase#emitSuccess
*
org.apache.servicecomb.foundation.vertx.client.ClientPoolManager#findByContext(io.vertx.core.Context)
创建HttpClientWithContext **并且加入pool里**
* 如果线程保持稳定 那么其实创建的context数量最多为线程数(context会缓存在threadLoca
io.vertx.core.impl.VertxImpl#stickyContextl里),但是由于线程数是25~100,繁忙时创建的线程可以被释放,所以一直会有context被创建然后引用。
## 临时规避方案
设置servicecomb.executor.default.maxThreads-per-group为25(同servicecomb.executor.default.coreThreads-per-group)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]