Node.js Nestjs/Axios HttpAgent({keepAlive:true})导致内存泄漏

Node.js Nestjs/Axios HttpAgent({keepAlive:true})导致内存泄漏,node.js,express,axios,nestjs,Node.js,Express,Axios,Nestjs,你好,我正在试图找出导致内存泄漏的问题 nestApp在Express应用程序中运行,因为旧的Express应用程序已被弃用,我们可以将重构所有现有路由迁移到nest,而不破坏前端的更改 const httpAgent = new http.Agent({ keepAlive: true }); const httpsAgent = new https.Agent({ keepAlive: true }); export const DEFAULT_CONFIG: AxiosRequestC

你好,我正在试图找出导致内存泄漏的问题

nestApp在Express应用程序中运行,因为旧的Express应用程序已被弃用,我们可以将重构所有现有路由迁移到nest,而不破坏前端的更改

const httpAgent = new http.Agent({ keepAlive: true });
const httpsAgent = new https.Agent({ keepAlive: true });

export const DEFAULT_CONFIG: AxiosRequestConfig = {
  timeout: 1000,
  httpAgent,
  httpsAgent,
};

export const SOME_CONFIG: AxiosRequestConfig = {
  ...DEFAULT_CONFIG,
  timeout: +process.env.TIMEOUT,
  baseURL: process.env.UPSTREAM,
};

@Module({
  imports: [HttpModule.register(SOME_CONFIG)],
  providers: [SomeUpstreamService],
  exports: [SomeUpstreamService],
})
export class SomeAdapterModule {}
这就是我们为上游API初始化不同功能模块的方式

在Legacy Express应用程序中,我们使用Axios以及Http(s)代理KeepAlive true,因为2年来仅nestjs部分没有内存问题

当我在本地上运行一个小负载测试(20req/sec)时,我可以看到嵌套到上游API的请求上有很多套接字挂起错误

我还尝试了maxSockets、maxSocketsMs和keepAliveMsecs,但没有任何帮助

我希望Sombody能给我一个我错过了什么的暗示