Ruby driver fails to connect with JRuby 9.3

Connecting to Amazon DocumentDB (mongodb 5.0) from EKS pods. Some pods connect and work, others fail to connect. The failing pods stay at “server description unknown.” Log below which keeps repeating. Downgrading JRuby to 9.2 works.

Ruby driver version: 2.19.0 (also tried 2.18.2)
Jruby version: 9.3.9.0
Mongoid version: 7.5.3 (also tried 8)

Debug log:

MONGODB | Server description for cdris-cluster-dev.cluster-clrxvva0yuqz.us-west-2.docdb.amazonaws.com:27017 changed from 'unknown' to 'unknown'.
MONGODB | There was a change in the members of the 'Unknown' topology.
MONGODB | Error checking cdris-cluster-dev.cluster-clrxvva0yuqz.us-west-2.docdb.amazonaws.com:27017: Java::JavaUtilConcurrent::RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@3c76cafa[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@4913ed11[Wrapped task = org.jruby.ext.timeout.Timeout$TimeoutTask@62f85778]] rejected from java.util.concurrent.ScheduledThreadPoolExecutor@2b87cd3a[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
MONGODB | Server description for cdris-cluster-dev.cluster-clrxvva0yuqz.us-west-2.docdb.amazonaws.com:27017 changed from 'unknown' to 'unknown'.
MONGODB | There was a change in the members of the 'Unknown' topology.
MONGODB | Error checking cdris-cluster-dev.cluster-clrxvva0yuqz.us-west-2.docdb.amazonaws.com:27017: Java::JavaUtilConcurrent::RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@6621f2b0[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@731d9b2e[Wrapped task = org.jruby.ext.timeout.Timeout$TimeoutTask@79b6aead]] rejected from java.util.concurrent.ScheduledThreadPoolExecutor@2b87cd3a[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
MONGODB | Server description for cdris-cluster-dev.cluster-clrxvva0yuqz.us-west-2.docdb.amazonaws.com:27017 changed from 'unknown' to 'unknown'.

Hey @Sudhir_Rao,

Thanks for letting us know about this issue. Though our Ruby Driver’s Compatibility matrix does list JRuby 9.3 as working with both 2.19 and 2.18, we can only guarantee this behavior when connecting to a MongoDB cluster.

The Ruby Driver (as well as Mongoid) are tested extensively against JRuby, however DocumentDB is an external product that is managed by AWS. They have some documentation for troubleshooting connection issues, but aside from that if you have difficulties with DocumentDB you’d need to work with their support team to determine why these issues appear to persist with JRuby 9.3 when JRuby 9.2 works as expected.