soot-oss / heros

IFDS/IDE Solver for Soot and other frameworks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IDESolver never uses more than 1 thread

tim-hoffman opened this issue · comments

According to the documentation of ThreadPoolExecutor (the superclass of CountingThreadPoolExecutor):

Using an unbounded queue (for example a LinkedBlockingQueue without a predefined capacity) will cause new tasks to wait in the queue when all corePoolSize threads are busy. Thus, no more than corePoolSize threads will ever be created. (And the value of the maximumPoolSize therefore doesn't have any effect.)

Thus, the executor in IDESolver initialized as below will never start more than 1 thread.

new CountingThreadPoolExecutor(1, this.numThreads, 30, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());

Just as a sidenote: In FlowDroid, we actually set the core pool size to the requested number of threads and the maximum pool size to Integer.MAX_VALUE. We don't use Heros anymore, but the structure of the IFDS solver based on executors is similar.

@Waldo1637 that's interesting. I am almost 100% sure I have tested and debugged Heros before and it was clearly showing multiple threads in the debugger. But maybe that's a regression...

Do you have a good suggestion for an optimal fix? Would it be most sensible to have a larger corePoolSize or should we be using another queue? I am sorry but I am not too familiar with the API, it seems.