我用cygwin跑的Python,开了1000个线程读取mongodb的数据,前面好好的,后面就开始报错了,这个问题挺久了,试了网上的方法好像都无效
File "/usr/lib/python2.7/site-packages/pymongo/collection.py", line 2524, in remove
with self._socket_for_writes() as sock_info:
File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/usr/lib/python2.7/site-packages/pymongo/mongo_client.py", line 825, in _get_socket
with server.get_socket(self.__all_credentials) as sock_info:
File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/usr/lib/python2.7/site-packages/pymongo/server.py", line 168, in get_socket
with self.pool.get_socket(all_credentials, checkout) as sock_info:
File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/usr/lib/python2.7/site-packages/pymongo/pool.py", line 790, in get_socket
sock_info = self._get_socket_no_auth()
File "/usr/lib/python2.7/site-packages/pymongo/pool.py", line 826, in _get_socket_no_auth
sock_info, from_pool = self.connect(), False
File "/usr/lib/python2.7/site-packages/pymongo/pool.py", line 763, in connect
_raise_connection_failure(self.address, error)
File "/usr/lib/python2.7/site-packages/pymongo/pool.py", line 211, in _raise_connection_failure
raise AutoReconnect(msg)
AutoReconnect: 127.0.0.1:27017: [Errno 112] Address already in use