# Mongodb ConnectionPoolExpired between it's replica members

**URL:** <https://forums.percona.com/t/mongodb-connectionpoolexpired-between-its-replica-members/25131>\
**Category:** Percona Operator for MongoDB\
**Created:** [September 12, 2023, 7:58pm UTC](https://forums.percona.com/t/mongodb-connectionpoolexpired-between-its-replica-members/25131 "2023-09-12T19:58:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed\_Asim](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ahmed_asim/32/11499_2.png) [@Ahmed\_Asim](https://forums.percona.com/u/Ahmed_Asim)\
**Post date:** [September 12, 2023, 7:58pm UTC](https://forums.percona.com/t/mongodb-connectionpoolexpired-between-its-replica-members/25131/1 "2023-09-12T19:58:51Z")

</div>

Hi,

I have cross site replication enabled using percona mongodb operator, mongo version 6.0.4-3  
we are using oracle load balancer to expose the pods and we noticed a drop happens suddenly in the connection and when we check the logs we found the below:

```auto
{"t":{"$date":"2023-09-12T19:15:01.043+00:00"},"s":"I", "c":"CONNPOOL", "id":22572, "ctx":"ShardRegistry","msg":"Dropping all pooled connections","attr":{"hostAndPort":"10.11.10.18:27017","error":"ConnectionPoolExpired: Pool for 10.11.10.18:27017 has expired."}}
{"t":{"$date":"2023-09-12T19:19:31.387+00:00"},"s":"I", "c":"CONNPOOL", "id":22572, "ctx":"ShardRegistry","msg":"Dropping all pooled connections","attr":{"hostAndPort":"10.11.10.1:27017","error":"ConnectionPoolExpired: Pool for 10.11.10.1:27017 has expired."}}

```

please note the IPs mentioned in the logs is for the DR site.

here the graph from the LB:

 ![image (14)](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/6/6316909a475e3b772138a68c3d811c70d4c7e313.jpeg)

I noticed the drop happened every 2 hours also number of connections varies from 3K to 5K

appreciate your usual support

---

<div class="post-metadata">

**Author:** ![Ahmed\_Asim](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ahmed_asim/32/11499_2.png) [@Ahmed\_Asim](https://forums.percona.com/u/Ahmed_Asim)\
**Post date:** [September 12, 2023, 8:33pm UTC](https://forums.percona.com/t/mongodb-connectionpoolexpired-between-its-replica-members/25131/2 "2023-09-12T20:33:47Z")

</div>

can see this from pmm server

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/6/6cf78b81631e8ab8985ccf8f9a8b2d90ec0e98d5.png)

---

<div class="post-metadata">

**Author:** ![Ahmed\_Asim](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ahmed_asim/32/11499_2.png) [@Ahmed\_Asim](https://forums.percona.com/u/Ahmed_Asim)\
**Post date:** [September 12, 2023, 8:46pm UTC](https://forums.percona.com/t/mongodb-connectionpoolexpired-between-its-replica-members/25131/3 "2023-09-12T20:46:05Z")

</div>

also please check the below output from mongostat the number of connection was 5816 and suddenly became 851

```auto
insert query update delete getmore command dirty used flushes vsize res qrw arw net_in net_out conn set repl time
    *0 *0 *0 *0 0 462|0 0.0% 81.6% 0 13.5G 4.73G 0|0 2|0 101k 552k 5809 rs0 SLV Sep 12 13:04:36.247
    *0 *0 *0 *0 0 566|0 0.0% 81.3% 0 13.5G 4.73G 0|0 2|0 137k 673k 5809 rs0 SLV Sep 12 13:04:37.241
    *0 *0 *0 *0 0 1500|0 0.0% 80.7% 0 13.5G 4.73G 0|0 0|0 436k 35.3m 5812 rs0 SLV Sep 12 13:04:38.238
    *0 *0 *0 *0 3 237|0 0.0% 81.3% 0 13.5G 4.73G 0|0 2|0 66.1k 440k 5812 rs0 SLV Sep 12 13:04:39.241
    *0 3 *0 *0 0 624|0 0.0% 80.9% 0 13.4G 4.73G 0|0 2|0 146k 979k 5789 rs0 SLV Sep 12 13:04:40.245
    *0 *0 *0 *0 0 504|0 0.0% 81.1% 0 13.5G 4.73G 0|0 2|0 111k 590k 5810 rs0 SLV Sep 12 13:04:41.244
    *0 *0 *0 *0 0 246|0 0.0% 81.2% 0 13.5G 4.73G 0|0 2|0 57.0k 336k 5813 rs0 SLV Sep 12 13:04:42.244
    *0 *0 *0 *0 0 233|0 0.0% 80.8% 0 13.5G 4.73G 0|0 2|0 61.1k 307k 5816 rs0 SLV Sep 12 13:04:43.241
    *0 *0 *0 *0 3 287|0 0.0% 80.8% 0 13.5G 4.73G 0|0 2|0 303k 566k 5816 rs0 SLV Sep 12 13:04:44.241
    *0 2 *0 *0 0 70|0 0.0% 80.5% 0 13.0G 4.77G 0|0 2|0 20.1k 733k 851 rs0 SLV Sep 12 13:04:45.444

```

---

<div class="post-metadata">

**Author:** ![Ahmed\_Asim](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ahmed_asim/32/11499_2.png) [@Ahmed\_Asim](https://forums.percona.com/u/Ahmed_Asim)\
**Post date:** [September 13, 2023, 10:44pm UTC](https://forums.percona.com/t/mongodb-connectionpoolexpired-between-its-replica-members/25131/4 "2023-09-13T22:44:00Z")

</div>

here sudden drop after it reaches 8.94K connections, this very weird isn’t it?!

 ![image](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/4/44436e8f98698f4bfbf28c6da5aeb7b27c3d7490.png)

---

<div class="post-metadata">

**Author:** ![Ahmed\_Asim](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ahmed_asim/32/11499_2.png) [@Ahmed\_Asim](https://forums.percona.com/u/Ahmed_Asim)\
**Post date:** [September 13, 2023, 11:12pm UTC](https://forums.percona.com/t/mongodb-connectionpoolexpired-between-its-replica-members/25131/5 "2023-09-13T23:12:31Z")

</div>

I tried to get the number of connections using

```auto
var idleConnections = db.serverStatus().connections.available;
print("Number of idle connections: " + idleConnections);

```

and I got `Number of idle connections: 837677`

can someone please tell why mongo opens all of this idle connection after we applied cross site replication ?

@Sergey_Pronin

---

<div class="post-metadata">

**Author:** ![Slava\_Sarzhan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/slava_sarzhan/32/3196_2.png) [@Slava\_Sarzhan](https://forums.percona.com/u/Slava_Sarzhan)\
**Post date:** [September 26, 2023, 7:14pm UTC](https://forums.percona.com/t/mongodb-connectionpoolexpired-between-its-replica-members/25131/6 "2023-09-26T19:14:40Z")

</div>

Hi @Ahmed_Asim It can be connected with the following bug [[K8SPSMDB-962] Percona Operator POD constantly increasing CPU and Memory usage - Percona JIRA](https://jira.percona.com/browse/K8SPSMDB-962) . It was fixed for v1.15.0. We have a plan to have release next week.
