Aias00 opened a new issue, #7750:
URL: https://github.com/apache/shenyu/issues/7750
### Current behavior
`AbstractLogPluginDataHandler.handlerSelector()` returns immediately for an
empty or `{}` selector handle, leaving the previous `SELECT_API_CONFIG_MAP`
entry intact. `LogCollectConfigUtils.isSampled()` prefers that entry's sampler,
so clearing the override does not restore global/default sampling.
### Locations / trigger
-
[AbstractLogPluginDataHandler.java:124–138](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/handler/AbstractLogPluginDataHandler.java#L124)
-
[LogCollectConfigUtils.java:106–114](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/utils/LogCollectConfigUtils.java#L106)
Set global sampling to 0, configure selector sampling to 1, then update the
selector handle to `{}`. The old always-sample entry remains. The reverse
transition can also leave logging suppressed when operators expect fallback to
a nonzero global rate.
### Reproduction / validation
A Java probe compiled the current abstract logging handler and configuration
utility. A concrete no-I/O subclass exercised actual
`handlerSelector()`/`isSampled()` calls, with a global never-sample control:
```text
SELECTOR_1_GLOBAL_0 sampled=true
AFTER_CLEAR sampled=true selectorEntry=true
REMOVE_CONTROL sampled=false
```
`removeSelector()` is the passing control demonstrating that removal
restores global sampling. A separate reviewer independently confirmed the
stale-map path. No backend log delivery or provider credentials were involved.
### Impact / expected behavior
Runtime logging can continue at a stale selector rate indefinitely after a
configuration clear, producing unexpected volume or missing expected records.
Clearing a selector override should remove it or otherwise resolve sampling
from the current global configuration.
### Suggested fix
Remove the selector-specific config on empty/`{}` updates and audit
overrides that bypass this generic handler. Preserve applicable backend-client
teardown without conflating sampling-map cleanup with client resource ownership.
### Related existing work
#7455 concerns re-enabling a stopped collector; #7454 concerns RabbitMQ
selector-client recreation; #7686 concerns JVM-shutdown cleanup; #7687 concerns
queue-drop metrics. This issue reproduces stale selector sampling after
clearing configuration, independently of collector start/stop or queue
behavior. Complete-title, open-PR and live sampling searches found no matching
report.
### Reviewed revision
Apache ShenYu 2.7.2-SNAPSHOT,
`master@66d7d954ca37d651a5ad916f988a8081157a7ab4`. P2 / Medium, high
confidence. Unit-test and CI issue categories excluded.
--
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]