mongodb IndexError:从空双端队列中弹出

时间:2021-01-07 15:42:42

标签: mongodb pymongo

我正在运行 pymongo 客户端并反复收到此错误。这是什么意思,我该如何预防?

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

我正在测试服务器响应延迟很长时间的设置。但我希望客户端不应该收到任何类型的超时错误。 要进行哪些更改以防止服务器或客户端发生这些变化?

0 个答案:

没有答案