AnsweredAssumed Answered

Smack create too much threads with newCachedThreadPool

Question asked by sigmon on Jul 27, 2017
Latest reply on Jul 28, 2017 by Flow

when I need to send a large number of IQ in short time, smack will create large number of thread with CachedThreadPool. And this cause crashes on Huawei phones with Android 7.0 or higher.

I got


pthread_create (1040KB stack) failed: Out of memory


1 java.lang.Thread.nativeCreate(Native Method)

2 java.lang.Thread.start(

3 java.util.concurrent.ThreadPoolExecutor.addWorker(

4 java.util.concurrent.ThreadPoolExecutor.processWorkerExit(ThreadPoolExecutor.jav a:1009)

5 java.util.concurrent.ThreadPoolExecutor.runWorker(

6 java.util.concurrent.ThreadPoolExecutor$


". When I reappear the crash, I found more then 120 thread create by "Smack-Cached Executor", and I modify the cachedExecutorService as newFixedThreadPool (in smack-core/src/main/java/org/jivesoftware/smack/, the APP works well.


I hope this will help.