Skip to content

[BUG] Clearing selector logging configuration leaves the previous sampler active #7750

Closed

Description

@Aias00

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

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:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions