A large number of CLOSE_WAIT appears in netty tcp connection

LAST_ACK 5
SYN_RECV 2
CLOSE_WAIT 2
ESTABLISHED 863
FIN_WAIT1 22
FIN_WAIT2 106
TIME_WAIT 4698

when the ESTABLISHED reaches 2000, the sharp-sharp-sharp problem description is gradually increasing.

the server Aliyun 4-core 16G, run unsatisfactorily

related codes

@ Slf4j
@ Component
public class NettyServer {

private EventLoopGroup bossGroup;

private EventLoopGroup workerGroup;

@Autowired
private NettyServerConfig nettyServerConfig;

public void start() {
    //bossGroup
    bossGroup = new NioEventLoopGroup();
    //workerGroupboss
    workerGroup = new NioEventLoopGroup();
    try {
        ServerBootstrap serverBootstrap = new ServerBootstrap();
        serverBootstrap.group(bossGroup, workerGroup);
        serverBootstrap.channel(NioServerSocketChannel.class);
        serverBootstrap.childHandler(new ChannelInitializer<Channel>() {
            @Override
            protected void initChannel(Channel ch) throws Exception {
                
                ch.pipeline().addLast(new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN,Integer.MAX_VALUE,0,4,2,4,true));
                ch.pipeline().addLast(new IdleStateHandler(600, 600, 600, TimeUnit.SECONDS));//600
                ch.pipeline().addLast("handler", new NettyServerHandler());
            }
        });
        serverBootstrap.childOption(ChannelOption.SO_KEEPALIVE, true);//
        
        ChannelFuture f = serverBootstrap.bind(nettyServerConfig.getPort()).sync();
        if(f.isSuccess()){
            log.info("TCP Server Start Success------Port---" + nettyServerConfig.getPort() + "");
            f.channel().closeFuture().sync();
        } else {
            log.error("TCP Server Start Failed------Port---" + nettyServerConfig.getPort() + "");
        }
    } catch (Exception e) {
        log.error("======nettyserver stop======", e);
        stop();
    }
}

public void stop(){
    bossGroup.shutdownGracefully();
    workerGroup.shutdownGracefully();
}

}

@ Slf4j
@ Service
public class NettyServerHandler extends ChannelInboundHandlerAdapter {

/**
 * channelAction
 *
 * 
 *
 */
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {

    //
    Channel channel = ctx.channel();

    //
    NettyChannelManager.addTimeClear(channel);

}

/**
 *  
 */
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {

    try {
        Integer roomNumber = NettyChannelUtil.getRoomNumber(ctx.channel());
        if (roomNumber != null) {
            //
            GameNavigation gameNavigation = SpringContextHolder.getBean(GameNavigation.class);
            gameNavigation.exitRoom(ctx.channel());
        }
    } catch (Exception e) {
        log.error("channelInactive Exception", e);
    }

}

/**
 * @param ctx
 * @param msg
 * @throws Exception
 */
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {

    ByteBuf byteBuf = (ByteBuf) msg;
    try {
        int code = ByteBufUtil.readShort(byteBuf);

        byte[] bytes = ByteBufUtil.readBytes(byteBuf);

        GameNavigation gameNavigation = SpringContextHolder.getBean(GameNavigation.class);
        RoomProducer roomRequest = new RoomProducer();
        roomRequest.sendRoomRequest(code,bytes);
        gameNavigation.navigation(ctx.channel(), code, bytes);

    }catch (Exception e){
        log.error("channelRead Exception", e);
    } finally {
        byteBuf.release();
    }

}

/*
 * exceptionCaught
 *
 * exception    
 * Caught        
 *
 * 
 *
 */
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
{
    try{
        if(cause.getClass() != IOException.class)
        {
            cause.printStackTrace();

/ / close ();

        }

    }catch (Exception e){
        e.printStackTrace();
    }
}

/**
 * 
 */
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {

}

}

what result do you expect? What is the error message actually seen?

Mar.28,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea7f13-1e95.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea7f13-1e95.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?