4

I got following error when I'm calling function mongoTemplate.collectionExists

com.mongodb.MongoCommandException: Command failed with error 2: 'Cannot open a new cursor since too many cursors are already opened' on server documentdb-cluster-dev-2.cipll54l4b4g.eu-central-1.docdb.amazonaws.com:27017. The full response is
{
    "ok": 0,
    "errmsg": "Cannot open a new cursor since too many cursors are already opened",
    "code": 2
}

at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:131)
at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2589)
at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:499)
at org.springframework.data.mongodb.core.MongoTemplate.collectionExists(MongoTemplate.java:600)
at sun.reflect.GeneratedMethodAccessor217.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:223)
at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.invoke(GenericScope.java:494)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
at org.springframework.data.mongodb.core.MongoTemplate$$EnhancerBySpringCGLIB$$ba89d337.collectionExists(<generated>)

I'm using MongoTemplate of spring framework and DocumentDB of AWS as a mongodb (spring-boot-starter-data-mongodb:2.0.10.RELEASE)

Is there any way to increase the limit of cursor? I saw for ORACLE, there is a way for increasing limit of open cursors, but didn't find anything for mongo/documentDb.

was_777
  • 599
  • 1
  • 9
  • 28
  • DocumentDB seems to have intentionally put limits on cursors per instance type (ref: https://docs.aws.amazon.com/documentdb/latest/developerguide/limits.html). Can you elaborate a bit on why you need more open cursors? Are you closing idle cursors when you don't need them? – krg265 Oct 21 '20 at 10:39

0 Answers0