Skip to content

fix(memory-leak): 修复 EventLoopGroup 线程泄漏及定时任务异常保护#803

Open
ArthurZhu1992 wants to merge 1 commit into
BeiDouMS:masterfrom
ArthurZhu1992:fix/memory-leak
Open

fix(memory-leak): 修复 EventLoopGroup 线程泄漏及定时任务异常保护#803
ArthurZhu1992 wants to merge 1 commit into
BeiDouMS:masterfrom
ArthurZhu1992:fix/memory-leak

Conversation

@ArthurZhu1992

Copy link
Copy Markdown
Contributor

变更内容

1. EventLoopGroup 泄漏修复(ChannelServer/LoginServer)

  • parentGroup/childGroup 从局部变量改为实例字段
  • stop() 中增加 shutdownGracefully(),确保服务关闭时 Netty 线程组被正确回收

2. 速率限制后立即返回(ChannelServerInitializer/LoginServerInitializer)

  • socketChannel.close() 后加 return,避免在已关闭连接上继续创建 Client 和 pipeline,防止资源泄漏

3. 定时任务异常保护(EventScriptScheduler)

  • r.run() 包裹 try-catch,防止单个任务抛未捕获异常导致调度器线程崩溃

…roup properly

- EventScriptScheduler: wrap scheduled task execution in try-catch to
  prevent Runnable leak in registeredEntries
- LoginServer/ChannelServer: save EventLoopGroup as fields, add
  shutdownGracefully() in stop()
- LoginServerInitializer/ChannelServerInitializer: add return after
  socketChannel.close() when rate limit exceeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant