开发者社区> 问答> 正文

mongodb出现MongoInterruptedException异常

最近将mongodb从单节点转换成分片集群,单日内流量也比之前增加了不少,频繁的出现异常,下面这个怎么破:

Caused by: com.mongodb.MongoInterruptedException: Interrupted acquiring a permit to retrieve an item from the pool 
    at com.mongodb.internal.connection.ConcurrentPool.acquirePermit(ConcurrentPool.java:186)
    at com.mongodb.internal.connection.ConcurrentPool.get(ConcurrentPool.java:126)
    at com.mongodb.connection.DefaultConnectionPool.getPooledConnection(DefaultConnectionPool.java:256)
    at com.mongodb.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:97)
    at com.mongodb.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:86)
    at com.mongodb.connection.DefaultServer.getConnection(DefaultServer.java:77)
    at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.getConnection(ClusterBinding.java:86)
    at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:422)
    at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:397)
    at com.mongodb.operation.CountOperation.execute(CountOperation.java:232)
    at com.mongodb.operation.CountOperation.execute(CountOperation.java:55)
    at com.mongodb.Mongo.execute(Mongo.java:810)
    at com.mongodb.Mongo$2.execute(Mongo.java:797)
    at com.mongodb.DBCollection.getCount(DBCollection.java:1004)
    at com.mongodb.DBCollection.count(DBCollection.java:854)
    at org.springframework.data.mongodb.core.MongoTemplate$8.doInCollection(MongoTemplate.java:779)
    at org.springframework.data.mongodb.core.MongoTemplate$8.doInCollection(MongoTemplate.java:777)
    at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:482)
    ... 33 common frames omitted
Caused by: java.lang.InterruptedException: null
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1326)
    at java.util.concurrent.Semaphore.tryAcquire(Semaphore.java:409)
    at com.mongodb.internal.connection.ConcurrentPool.acquirePermit(ConcurrentPool.java:180)
    ... 50 common frames omitted

展开
收起
magicalman 2021-10-26 18:25:34 2736 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
开源数据库 MongoDB 专场 MongoDB疑难杂症分析及优化 立即下载
MongoDB多数据中心的方案选型之路 立即下载
饿了么高级架构师陈东明:MongoDB是如何逐步提高可靠性的 立即下载