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
"java.lang.OutOfMemoryError
pthread_create (1040KB stack) failed: Out of memory
". 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/AbstractXMPPConnection.java), the APP works well.
when I need to send a large number of IQ in short time, smack will create large number of thread with CachedThreadPool.
How do you send those IQs? Using sendStanza() or createStanzaCollectorAndSend() should not create extra threads. And Smack’s sendWithResponseCallback() API does not use the “Smack-Cached Executor”.
The “Smack-Cached Executor” is used when invoking stanza listeners asynchronously. Maybe one of those listeners blocks when it shouldn’t? This would cause the thread count of the executor to increase.
I don’t see where cachedExecutorService is used in this code snippet.
And do you really need to use such a low level method as sendStanzaWithResponseCallback()? Usually there is a better method in Smack’s API for most use cases.
Hello, I’m encountering this problem as well with Smack version 4.2.4, particularly when messages are incoming to the device in hundreds within a short amount of time. Could you advice me on this matter?
I’m not sure what you would need from me to help me with this now that Android Studio has changed their approach with the Device Monitor, so do tell me the information you require for this matter.