java.util.concurrent.RejectedExecutionException

Since upgrading to Mongo 6.0.8 we experience the java.util.concurrent.RejectedExecutionException error.

We are currently running the java driver version 4.5 but we can’t upgrade because of the fact that we are still running Java11 and have dependency on the bson.records.codec.

We want to know what this error entails and what we can do to maybe fix it.

2023-08-18 04:09:41,156 ERROR [stderr] (cluster-ClusterId{value='64deef05d0f94033591f9522', description='null'}-plnd-mu-shard-00-02.mtgmk.mongodb.net:27017) Exception in thread "cluster-ClusterId{value='64deef05d0f94033591f9522', description='null'}-plnd-mu-shard-00-02.mtgmk.mongodb.net:27017" java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@b98f4d[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@71419177[Wrapped task = com.mongodb.internal.connection.DefaultConnectionPool$BackgroundMaintenanceManager$$Lambda$2114/0x000000010462bc40@3fc9e890]] rejected from java.util.concurrent.ScheduledThreadPoolExecutor@5593aee0[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]

This is just a connection pool maintenance task that is being schedule as the pool is being shut down. So I think the log message is harmless. Unless you are seeing ill effects in the application it’s likely safe to ignore it.

Regards bson.record.codec: the bulk of our users are still on Java 11 so this shouldn’t be an issue for you. What error are you seeing that makes you think this is a problem?

Regards,
Jeff

Hey Jeffrey,

Thanks for the heads up! As for your question. When trying to upgrade our environment we couldn’t because of a dependency to the bson.record.codec. But because we use it on our code base and we don’t want it excluded we needed to upgrade. As per your college, so that’s why we can’t upgrade.

Kind Regards,
Donneh