Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关闭项目时其创建的线程并未关闭报警告信息 #201

Open
lichengqian111 opened this issue Jul 3, 2024 · 0 comments
Open

Comments

@lichengqian111
Copy link

lichengqian111 commented Jul 3, 2024

The web application [zdsspj] appears to have started a thread named [OkHttp TaskRunner] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:460)
okhttp3.internal.concurrent.TaskRunner$RealBackend.coordinatorWait(TaskRunner.kt:294)
okhttp3.internal.concurrent.TaskRunner.awaitTaskToRun(TaskRunner.kt:218)
okhttp3.internal.concurrent.TaskRunner$runnable$1.run(TaskRunner.kt:59)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:750)
17:21:23.233 [restartedMain] WARN o.a.c.loader.WebappClassLoaderBase - The web application [zdsspj] appears to have started a thread named [Okio Watchdog] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
okio.AsyncTimeout$Companion.awaitTimeout$okio(AsyncTimeout.kt:300)
okio.AsyncTimeout$Watchdog.run(AsyncTimeout.kt:187)

springboot项目的关闭方式为 以下方式时可以复现
@slf4j
@EnableAsync
@EnableCaching
@EnableScheduling
@SpringBootApplication(exclude = { SaTokenDaoRedisJackson.class })
public class PortalApplication {

public static void main(String[] args) throws UnknownHostException {
	ConfigurableApplicationContext applicationContext = SpringApplication.run(PortalApplication.class, args);
    Environment env = applicationContext.getEnvironment();
   
    // 生成获取控制台输入信息对象
    try(Scanner scanner = new Scanner(System.in)) {
        // 循环
        while(true){
            //获取控制台输入,如果没有会被阻塞
            String in = scanner.nextLine();
            //如果输入 q表示退出程序
            if(in.equals("q")){
                break;
            }
        }
        // 退出 spring boot
        SpringApplication.exit(applicationContext);
    }
}

}

版本

com.dtflys.forest
forest-spring-boot-starter
1.5.36

配置
forest:
connect-timeout: 20000
read-timeout: 20000
backend: okhttp3 # 后端 HTTP 框架(默认为 okhttp3)
max-connections: 500 # 连接池最大连接数(默认为 500)
max-route-connections: 500 # 每个路由的最大连接数(默认为 500)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant