Aias00 opened a new issue, #7455:
URL: https://github.com/apache/shenyu/issues/7455

   ## Is there an existing issue for this?
   
   - [x] I searched open and closed issues.
   
   ## Current Behavior
   
   An asynchronous logging plugin can remain stopped after being disabled and 
re-enabled with unchanged global configuration.
   
   `AbstractLogPluginDataHandler.handlerPlugin()` initializes the client and 
starts the collector only when the parsed configuration differs from the 
retained `Singleton` value. Disabling closes the collector and its client but 
retains that configuration. Re-enabling with the same JSON therefore skips both 
initialization and startup.
   
   The plugin is reinserted into the request chain, but 
`AbstractLogCollector.collect()` drops logs while its `started` flag remains 
false.
   
   ## Expected Behavior
   
   An enabled plugin should have an active collector and client, independently 
of whether the configured values changed since its previous enabled state.
   
   ## Steps To Reproduce
   
   1. Enable an affected logging plugin with valid configuration `A`.
   2. Disable the plugin through an enabled=false configuration update.
   3. Re-enable it without changing configuration `A`.
   4. Observe that logging does not resume.
   5. Change a global configuration value to `B` as a control: 
initialization/startup runs and logging can resume.
   
   An offline harness compiled the current abstract handler, collector and 
client. A no-network client/collector subclass exercised their actual lifecycle 
methods and atomic state:
   
   ```text
   initial enable A: collectorStarted=true, clientStarted=true, 
initializationCount=1
   disable A: collectorStarted=false, clientStarted=false, initializationCount=1
   re-enable identical A: collectorStarted=false, clientStarted=false, 
initializationCount=1
   changed configuration B: collectorStarted=true, clientStarted=true, 
initializationCount=2
   ```
   
   ## Location And Impact
   
   - 
[AbstractLogPluginDataHandler.java:105](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/handler/AbstractLogPluginDataHandler.java#L105):
 startup is gated by config equality.
   - 
[AbstractLogPluginDataHandler.java:115](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/handler/AbstractLogPluginDataHandler.java#L115):
 disable closes without resetting the retained config.
   - 
[AbstractLogCollector.java:314](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-common/src/main/java/org/apache/shenyu/plugin/logging/common/collector/AbstractLogCollector.java#L314):
 close stops collection and closes the consume client.
   - 
[CommonPluginDataSubscriber.java:240](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/cache/CommonPluginDataSubscriber.java#L240):
 plugin UPDATE events reach the handler; disabled updates are distinct from 
DELETE/removal.
   
   Severity: Medium. Confidence: high. Gateway traffic can continue while the 
affected logging plugins silently omit logs after a normal operator 
disable/re-enable action. Scope is handlers inheriting this shared lifecycle 
logic, not every logging implementation.
   
   ## Suggested Fix And Regression Coverage
   
   Treat configuration equality and lifecycle activity separately. On 
re-enable, ensure both the consume client and collector are active, even if the 
values are unchanged. Clearing retained state on disable or tracking 
initialized/active state can ensure the initialization path runs. Calling 
collector.start() alone is insufficient if close() also stopped the client.
   
   Add enabled `A` -> disabled -> enabled identical `A` regression coverage 
asserting both components restart and consume logs. Retain already-enabled 
unchanged-config and changed-config controls; preserve idempotent startup.
   
   ## Validation And Related Issues
   
   Reviewed master at `67596c1d228b62da75cd0a0ecb47d0ac5d995384` 
(`2.7.2-SNAPSHOT`). An independent verifier reproduced skipped startup with a 
counting handler and traced the real subscriber/enable event flow. Leader 
reproduced stopped state using actual abstract lifecycle implementations. 
Existing `AbstractLogCollectorTest`: 12 tests passed; selected RabbitMQ 
handler/cache tests: 9 passed.
   
   #6655 fixed repeated start calls leaking executors, not re-enable skipping 
startup. #6766 concerned concrete Huawei config equality omitting fields. The 
RabbitMQ selector-restore candidate is a separate selector cache inconsistency.
   
   No external log sink or broker was contacted by the new lifecycle 
reproduction.
   


-- 
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]

Reply via email to