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

   ## Problem
   `ClusterConfiguration` registers the running-mode bean with 
`destroyMethod="shutdown"`, but `ShenyuClusterService.shutdown()` is empty. Its 
owned `ScheduledThreadPoolExecutor` is neither shut down nor cancelled. 
Context/bean shutdown can therefore leave election calls running against 
dependencies being destroyed; an active leader renewal loop also has no 
explicit shutdown signal.
   
   The executor uses daemon threads, so this issue does not claim that this 
scheduler alone prevents JVM exit. It concerns continuing cluster activity 
after the service shutdown contract returns, resource retention during context 
reuse, and orderly leadership release.
   
   ## Verified reproduction
   Current `ShenyuClusterService` source recompiled at 
`66d7d954ca37d651a5ad916f988a8081157a7ab4`, Java 17. A controlled election 
provider always returns false (no real JDBC/ZooKeeper server). Start the actual 
scheduler with a one-second period, wait for its first attempt, call the real 
`shutdown`, then wait on a latch for another attempt.
   
   Observed: `executor.isShutdown()` remained false, and a subsequent election 
attempt executed after `shutdown()` returned. The fixture forcibly shut down 
and awaited the scheduler in `finally`. No live leader or deployed Spring 
context shutdown was tested.
   
   ## Evidence
   - [Owned scheduler and recurring election 
task](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/mode/cluster/service/ShenyuClusterService.java#L47)
   - [Empty 
shutdown](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/mode/cluster/service/ShenyuClusterService.java#L126)
   - [Bean destroy 
method](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/config/ClusterConfiguration.java#L58)
   
   ## Acceptance criteria
   - [ ] Shutdown prevents new election/renewal work and closes the owned 
executor with a documented bounded wait.
   - [ ] Terminate an active renewal loop and release leadership through the 
owning thread/provider contract; do not blindly unlock thread-owned locks from 
another thread.
   - [ ] Coordinate upstream/instance task cleanup without one cleanup failure 
skipping the others.
   - [ ] Test follower shutdown, active-leader shutdown, shutdown during a 
provider call, repeated shutdown and start/stop lifecycle as supported.
   - [ ] No election attempt occurs after completed shutdown and no owned 
worker remains active.
   
   Related: #6495 tracks election cancellation after renewal exceptions; #7748 
is instance-checker final-flush cleanup. Those are different failure paths.
   


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