-
Type: Bug
-
Resolution: Gone away
-
Priority: Unknown
-
None
-
Affects Version/s: 2.9.2, 3.12.2
-
Component/s: Cluster Mgmt
-
None
Hello,
I have a problem regarding mongo. Here is my setup:
- 3 mongod with replica set on 3 different virtual machine
- 1 mongo-configsvr on each of the 3 previous VM
- 1 mongos on the client VM to route to the 3 mongod
- A soft developed in Python (with PyMongo)
Now, my problem. I'm developing a software that request a lot mongo. The problem appeared when my primary mongod VM lost network. At this time, the request that was last sent was stuck.
By stuck I mean that the request wont work, but will not raise any "AutoReconnect" to let me do the request again so it can route to the new primary.
The request is totally stucked, it will raise an error after 15 minutes OR if the network goes up again on the previous primary.
I wrote a script to explain the problem:
```
#!/usr/bin/python
coding: utf-8
import sys
import threading
import time
from pymongo import MongoClient
def main():
mongo_client = MongoClient()
db = mongo_client.test
collection = db['test']
collection.drop()
collection = db['test']
print u'Connected; lets go !'
while True:
t0 = time.time()
collection.insert({'time': time.time()})
print u'Wait [%03.6f] | There is %s items in test collection' % ((time.time() - t0), collection.count())
print u'---------------------------------------------------------------'
time.sleep(1)
main()
```
As you can see in the code, I do one request per second. So I let the script run, and then I remove the ethernet cable on the primary. The script stuck at the insert, the print will not be printed until the ethernet cable is put back or after 15 minutes.
I can't believe that no one ever had the problem as losing network is not really hard. But I did not found anything using google.
Hope you will have answers, thank you!
- duplicates
-
PYTHON-3175 Preemptively cancel in progress operations when SDAM heartbeats timeout
- Closed
- is related to
-
SERVER-57468 Enable TCP_USER_TIMEOUT by default
- Backlog
- related to
-
PYTHON-2550 Client Side Operations Timeout
- Released
-
PYTHON-2709 Enable TCP_USER_TIMEOUT by default when possible
- Blocked