Skip to content

[BUG] HttpShenyuSdkClient never shuts down CloseableHttpAsyncClient / IOReactor — non-daemon threads block JVM exit #6854

Description

@Aias00

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions