apache / apache/shenyu

[BUG] No cleanup on channel close → repository leak for ungraceful disconnect

Open
#6,744 2 comments 0 reactions 1 assignee Claimed by @wy471x View on GitHub
plugin: mqtt priority: medium type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

- severity: Medium
- files: `shenyu-protocol/shenyu-protocol-mqtt/src/main/java/org/apache/shenyu/protocol/mqtt/MqttTransportHandler.java:42-44`; `MqttTransportServerInitializer.java:44`
- description: `MqttTransportServerInitializer` registers `handler` as a `GenericFutureListener` on `ch.closeFuture()`, but `MqttTransportHandler.operationComplete(Future)` has an empty body. Cleanup of `ChannelRepository`/`SubscribeRepository` only happens via explicit `DISCONNECT`. A client that drops TCP without DISCONNECT leaves its `Channel` and subscriptions registered forever.
- impact: Channel and subscription maps grow unbounded across disconnecting clients; future `send()`s try to write to closed channels.
- suggested_fix: In `operationComplete`, remove the closing channel from `ChannelRepository` and `SubscribeRepository`.
- confidence: High
- related_existing: none

---
_Identified during the 2026-08-02 deep re-scan; full list in [`docs/scan2-2026-08-02/06-medium-tiers.md`](docs/scan2-2026-08-02/06-medium-tiers.md)._

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.