Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

pymongo - mongodb IndexError: pop from an empty deque

I'm running a pymongo client and repeatedly getting this error. what does this mean and how can i prevent this?

Traceback (most recent call last):
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/pool.py", line 1278, in _get_socket
    sock_info = self.sockets.popleft()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/pool.py", line 694, in command
    exhaust_allowed=exhaust_allowed)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/network.py", line 150, in command
    reply = receive_message(sock_info, request_id)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/network.py", line 195, in receive_message
    _receive_data_on_socket(sock_info, 16, deadline))
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/network.py", line 286, in _receive_data_on_socket
    chunk_length = sock_info.sock.recv_into(mv[bytes_read:])
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "mgclient.py", line 18, in <module>
    result=db.reviews.insert_one(business)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/collection.py", line 701, in insert_one
    session=session),
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/collection.py", line 615, in _insert
    bypass_doc_val, session)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/collection.py", line 603, in _insert_one
    acknowledged, _insert_command, session)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1498, in _retryable_write
    return self._retry_with_session(retryable, func, s, None)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1384, in _retry_with_session
    return self._retry_internal(retryable, func, session, bulk)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1408, in _retry_internal
    with self._get_socket(server, session) as sock_info:
  File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1247, in _get_socket
    self.__all_credentials, checkout=exhaust) as sock_info:
  File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/pool.py", line 1231, in get_socket
    sock_info = self._get_socket(all_credentials)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/pool.py", line 1281, in _get_socket
    sock_info = self.connect(all_credentials)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/pool.py", line 1193, in connect
    sock_info.ismaster(all_credentials)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/pool.py", line 546, in ismaster
    return self._ismaster(None, None, None, all_credentials)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/pool.py", line 580, in _ismaster
    exhaust_allowed=awaitable)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/pool.py", line 699, in command
    self._raise_connection_failure(error)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/pool.py", line 891, in _raise_connection_failure
    _raise_connection_failure(self.address, error)
  File "/home/secondaryvm/.local/lib/python3.6/site-packages/pymongo/pool.py", line 286, in _raise_connection_failure
    raise AutoReconnect(msg)
pymongo.errors.AutoReconnect: 192.168.122.50:27017: [Errno 104] Connection reset by peer

I'm testing a setup where the responses from the server are delayed for long. But i want that client shouldn't get any type of timeout error. what changes to be made to prevent these either to server or client?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...