java.util.concurrent.RejectedExecutionException experienced when loading the roster using Smack API

After upgrading to Smack 4.1.4 we are experiencing the exception

We have 3,451 users in openfire, which has not been an issue previously. The following code is being used to replicate the issue:

    final XMPPTCPConnectionConfiguration.Builder builder = XMPPTCPConnectionConfiguration.builder();


    final XMPPTCPConnectionConfiguration config =;

    final XMPPTCPConnection connection = new XMPPTCPConnection(config);


    System.out.println("connection.isConnected() = " + connection.isConnected());

    connection.login("USERNAME", "PASSWORD", null);

    System.out.println("connection.isAuthenticated() = " + connection.isAuthenticated());

    System.out.println("Initiating roster load");

    final Roster roster = Roster.getInstanceFor(connection);

    System.out.println("Returned from initiating roster load");


    final BufferedReader reader = new BufferedReader(new InputStreamReader(;


        final String input = reader.readLine();






Output from the program :

Nov 19, 2015 12:59:32 PM org.jivesoftware.smack.util.DNSUtil resolveXMPPDomain

WARNING: No DNS Resolver active in Smack, will be unable to perform DNS SRV lookups

connection.isConnected() = true

connection.isAuthenticated() = true

Initiating roster load

Returned from initiating roster load

Nov 19, 2015 12:59:34 PM org.jivesoftware.smack.AbstractXMPPConnection callConnectionClosedOnErrorListener

WARNING: Connection closed with error

java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@3b19079e rejected from java.util.concurrent.ThreadPoolExecutor@142401c1[Running, pool size = 1, active threads = 1, queued tasks = 97, completed tasks = 265]

at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoo

at java.util.concurrent.ThreadPoolExecutor.reject(

at java.util.concurrent.ThreadPoolExecutor.execute(

at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.jav a:110)

at org.jivesoftware.smack.AbstractXMPPConnection.processPacket(AbstractXMPPConnect

at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessStanza(AbstractXMP

at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$500( 140)

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPC

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPCon

at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$


Despite the above error if I add a org.jivesoftware.smack.roster.RosterListener to the roster I can see that we receive 3447 entries added. I’m not sure where the missing 4 go from the 3451 users in openfire, but I am cannot say whether that is significant to this issue or not.

I have enabled the smack.debugEnabled system property, but fail to see any other errors that would help me diagnose this issue.

Has anyone else experienced this issue and come across a solution? Is this a not entirely unexpected error that I should be catching/logging/ignoring?


Sam Clunie

Thanks for reporting. That appears to be a bug in Smack. I assume the Executor has no, or the wrong, rejection policy set. Will have a look and report back.

Thanks Flow. Appreciate it.

Created SMACK-702, tracked as [SMACK-702] RejectedExecutionException in AbstractXMPPConnection.processPacket() causes connection Termination - Jive So…

I’ve uploaded Smack 4.1.5-SNAPSHOT with a supposed fix for the issue. Could you try and report back if works? Snapshot versions are available from the Maven Central snapshot repository.

Thanks Flow!

I’ve given my original code a run through multiple times switching between 4.1.4 and 4.1.5-SNAPSHOT libs, and can reliably replicate with 4.1.4, but not once with 4.1.5-SNAPSHOT.

I’d say it’s looking pretty good

Hi Flow,

I see that SMACK-702 has been marked as resolved. Do you have an ETA on the 4.1.5 release? If not, I’ll likely downgrade to 4.0.7 for our upcoming product release.


Smack 4.1.5 is already available on Maven Central. The website update and blog post announcing the release are pending. I’ll likely do that today (or pretty soon™).

Perfect, thanks Flow. Appreciate the quick response.