threadpool=cached can not recycle idle thread
- Dominant language
- Java
- Stars
- 41.6k
- Forks
- 26.4k
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 4
Description
### Environment
* Dubbo version: 2.7.5 / 2.7.12
* Java version: JDK1.8
### 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.
Contributor guide
Research direction
Start with the cached thread-pool configuration and the InternalRunnable.run stack frame shown in the report, then trace how dubbo.protocol.alive is applied to idle workers. Reproduce the configuration with a small service workload and verify that idle threads are removed after the configured interval.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100