IT 手制品

悠云闲语

问题描述

某系统接连出现连接泄漏问题。表现为:

  1. 使用 RabbitMQ 作为消息队列,使用 RabbitMQConnection 进行消息发送。
  2. 封装了 RabbitMQ 客户端,使用 ThreadLocal 保存 Connection

连接数持续增长,直到连接达到 RabbitMQ 的最大连接数,导致系统无法正常工作。

阅读全文 »

issue url

版本情况

hutool版本: 5

问题描述(包括截图)

参考文档构建代码:AIO封装-AioServer和AioClient
其中 AioClient 的示例如下:

public void foobar() {
AioClient client = new AioClient(new InetSocketAddress("localhost", 8899), new SimpleIoAction() {

@Override
public void doAction(AioSession session, ByteBuffer data) {
if(data.hasRemaining()) {
Console.log(StrUtil.utf8Str(data));
session.read();
}
Console.log("OK");
}
});

client.write(ByteBuffer.wrap("Hello".getBytes()));
client.read();

client.close();
}

若直接在生产环境调用此代码,将必然出现线程溢出 OOM

阅读全文 »
0%