Aias00 opened a new issue, #7471: URL: https://github.com/apache/shenyu/issues/7471
## Finding `TcpProxySelectorDataHandler.handlerProxySelector()` returns immediately when the selector name is already cached: - `shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-tcp/src/main/java/org/apache/shenyu/plugin/tcp/handler/TcpProxySelectorDataHandler.java:32-38` - `shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/cache/CommonProxySelectorDataSubscriber.java:40-43` - `shenyu-common/src/main/java/org/apache/shenyu/common/dto/ProxySelectorData.java:35-37` `ProxySelectorData` includes `forwardPort` and `props`, and the common proxy selector subscriber sends update events to `handlerProxySelector()`. However, once a selector name exists in `TcpBootstrapFactory`, the handler does not compare or apply the new port/properties. ## Trigger / caller flow An admin update changes a TCP selector's `forwardPort` or `props` while the selector name is already cached: `CommonProxySelectorDataSubscriber.onSubscribe(proxySelectorData)` -> `TcpProxySelectorDataHandler.handlerProxySelector(proxySelectorData)` -> `TcpBootstrapFactory.inCache(name)` -> early return. ## Actual behavior The handler logs that the TCP bootstrap server already exists and returns. The existing `TcpBootstrapServer` keeps listening on the old port with the old properties. ## Expected behavior Selector UPDATE should compare the effective TCP listener config. If `forwardPort` or `props` changed, the gateway should shut down and recreate/update the TCP bootstrap for that selector. ## Impact An operator can update a TCP selector in admin and see sync succeed while the data plane continues using the old listener settings until delete/recreate, full refresh, or gateway restart. ## Suggested fix Store effective config per cached selector name. In `handlerProxySelector()`: 1. No-op only when the incoming config equals the cached config. 2. If the port/properties changed, stop the old bootstrap. 3. Create the new bootstrap from the updated `ProxySelectorData`. 4. Update related selector/upstream cache entries atomically. Add a regression test for `same name + changed forwardPort`. ## Existing issue de-dupe This is not #6480, which is about delete leaving a TCP server running, and not #6735, which is about duplicate creation races. This issue is specifically about UPDATE events for an existing selector name being ignored. ## Validation - Source flow inspected at `a89b6a2338c24e978428b731e8f1edce86022418`. - `./mvnw -pl shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-tcp -am -Dtest=TcpProxySelectorDataHandlerTest test -DfailIfNoTests=false -Dcheckstyle.skip -Drat.skip=true -Djacoco.skip=true` passed. Existing tests do not cover changed config updates. ## Reviewed Revision And Validation Apache ShenYu 2.7.2-SNAPSHOT, master at a89b6a2338c24e978428b731e8f1edce86022418. Severity: medium. Confidence: high. Isolated review traced proxy-selector UPDATE delivery and the existing-server early return before listener configuration is read. Current source references: - `shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-tcp/src/main/java/org/apache/shenyu/plugin/tcp/handler/TcpProxySelectorDataHandler.java:32` - `shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/cache/CommonProxySelectorDataSubscriber.java:40` - `shenyu-common/src/main/java/org/apache/shenyu/common/dto/ProxySelectorData.java:35` No implementation fix or full deployed end-to-end validation was performed by this review. Source-flow and runtime evidence are distinguished above. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
