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

   ## Description
   `HttpShenyuSdkClient.initClient` constructs a `DefaultConnectingIOReactor`, 
a `PoolingNHttpClientConnectionManager`, and a `CloseableHttpAsyncClient` 
(started via `client.start()` at line 103), but neither `HttpShenyuSdkClient` 
nor `AbstractShenyuSdkClient` nor the `ShenyuSdkClient` interface defines any 
`close()`/`shutdown()`/`@PreDestroy`/`DisposableBean` lifecycle. The `@Bean` in 
`ShenyuSdkAutoConfiguration` has no `destroyMethod` and the type exposes no 
`close`/`AutoCloseable` method for Spring's inferred destroy to find, so 
nothing is ever closed on context shutdown. The `DefaultConnectingIOReactor` 
worker threads are non-daemon (Apache HttpCore `DefaultThreadFactory` default).
   
   ## Location
   - 
`shenyu-sdk/shenyu-sdk-httpclient/src/main/java/org/apache/shenyu/sdk/httpclient/HttpShenyuSdkClient.java:84-105`
   - 
`shenyu-sdk/shenyu-sdk-core/src/main/java/org/apache/shenyu/sdk/core/client/ShenyuSdkClient.java:33-54`
   - 
`shenyu-spring-boot-starter/shenyu-spring-boot-starter-sdk/src/main/java/org/apache/shenyu/springboot/starter/sdk/ShenyuSdkAutoConfiguration.java:82-91`
   
   ## Impact
   On every application-context close (Spring Boot devtools restart, test 
teardown, graceful shutdown), the async HTTP client, connection pool, and IO 
reactor leak; non-daemon reactor threads keep the JVM alive, forcing `kill -9`. 
Repeated context restarts accumulate leaked reactors/threads.
   
   ## Suggested fix
   Add `implements AutoCloseable` (or `DisposableBean`) to 
`ShenyuSdkClient`/`AbstractShenyuSdkClient` with a `close()` that shuts down 
the `CloseableHttpAsyncClient` and `PoolingNHttpClientConnectionManager` (and 
ideally make reactor threads daemon); Spring will then infer the destroy method.
   
   ## Related existing
   None — distinct from #6654 (LOG-02 logging-client thread pools), #6703 
(UpstreamCheckService.close leaks invokeExecutor), and #6761/#6769 (logging 
close). No baseline entry covers `shenyu-sdk` `HttpShenyuSdkClient` lifecycle.
   


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