You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Yang Wang (Jira)" <ji...@apache.org> on 2020/05/29 11:32:00 UTC

[jira] [Updated] (FLINK-18035) Executors#newCachedThreadPool could not work as expected

     [ https://issues.apache.org/jira/browse/FLINK-18035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yang Wang updated FLINK-18035:
------------------------------
    Description: 
In FLINK-17558, we introduce {{Executors#newCachedThreadPool}} to create dedicated thread pool for TaskManager io. However, it could not work as expected.

The root cause is about the following constructor of {{ThreadPoolExecutor}}. Only when the workQueue is full, new thread will be started then. So if we set a {{LinkedBlockingQueue}} with {{Integer.MAX_VALUE}} capacity, only one thread will be started.

 
{code:java}
public ThreadPoolExecutor(int corePoolSize,
                          int maximumPoolSize,
                          long keepAliveTime,
                          TimeUnit unit,
                          BlockingQueue<Runnable> workQueue,
                          ThreadFactory threadFactory)
{code}

  was:
In FLINK-17558, we introduce {{Executors#newCachedThreadPool}} to create dedicated thread pool for TaskManager io. However, it could not work as expected.

The root cause is about the following constructor of {{ThreadPoolExecutor}}. Only when the workQueue is full, new thread will be started then. So if we set a {{LinkedBlockingQueue}} with {{Integer.MAX_VALUE}} capacity, only one thread will be started.


> Executors#newCachedThreadPool could not work as expected
> --------------------------------------------------------
>
>                 Key: FLINK-18035
>                 URL: https://issues.apache.org/jira/browse/FLINK-18035
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / Coordination
>    Affects Versions: 1.11.0
>            Reporter: Yang Wang
>            Priority: Blocker
>             Fix For: 1.11.0
>
>
> In FLINK-17558, we introduce {{Executors#newCachedThreadPool}} to create dedicated thread pool for TaskManager io. However, it could not work as expected.
> The root cause is about the following constructor of {{ThreadPoolExecutor}}. Only when the workQueue is full, new thread will be started then. So if we set a {{LinkedBlockingQueue}} with {{Integer.MAX_VALUE}} capacity, only one thread will be started.
>  
> {code:java}
> public ThreadPoolExecutor(int corePoolSize,
>                           int maximumPoolSize,
>                           long keepAliveTime,
>                           TimeUnit unit,
>                           BlockingQueue<Runnable> workQueue,
>                           ThreadFactory threadFactory)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)