apache / dubbo

The java implementation of Apache Dubbo. An RPC and microservice framework.
https://dubbo.apache.org/
Apache License 2.0
40.52k stars 26.43k forks source link

threadpool=cached can not recycle idle thread #8342

Open ecyuan opened 3 years ago

ecyuan commented 3 years ago

Environment

my dubbo config

dubbo.protocol.threads=5
dubbo.protocol.corethreads=2
dubbo.protocol.alive=15000
dubbo.protocol.threadpool=cached

I hope idle thread will be recycle after 15 seconds.

Invoke some service, jstack java process show as follow, 5 thread idle:
"Dubbo-thread-5" #108 daemon prio=5 os_prio=0 tid=0x0000000033e54000 nid=0x2410 waiting on condition [0x000000004761e000]
        at org.apache.dubbo.common.threadlocal.InternalRunnable.run(InternalRunnable.java:41)
"Dubbo-thread-4" #107 daemon prio=5 os_prio=0 tid=0x0000000033e53800 nid=0x395c waiting on condition [0x000000004751f000]
        at org.apache.dubbo.common.threadlocal.InternalRunnable.run(InternalRunnable.java:41)
"Dubbo-thread-3" #106 daemon prio=5 os_prio=0 tid=0x0000000033e51000 nid=0x3858 waiting on condition [0x000000004741e000]
        at org.apache.dubbo.common.threadlocal.InternalRunnable.run(InternalRunnable.java:41)
"Dubbo-thread-2" #97 daemon prio=5 os_prio=0 tid=0x0000000033e4c800 nid=0x2210 waiting on condition [0x000000004637f000]
        at org.apache.dubbo.common.threadlocal.InternalRunnable.run(InternalRunnable.java:41)
"Dubbo-thread-1" #96 daemon prio=5 os_prio=0 tid=0x0000000033e47800 nid=0x12e8 waiting on condition [0x000000004526e000]

But after 15 seconds or more, these idle thread still alive, unexpectedly been recycled.

xiaoheng1 commented 3 years ago

Please check if the service is blocked.

ecyuan commented 3 years ago

Please check if the service is blocked.

No! In fact there are no any more request. Maybe you can test in local host, it should be repeated again.

Consider extending to use third-part thread pool component?