pymongo多线程报错Address already in use

  统计/机器学习 Python    浏览次数:4529        分享
1

我用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




 

莫斯   2017-12-12 15:59



   1个回答 
0

估计是port被占用了,不知道是不是前面的进程出了问题,试试把threads数量调小点,然后读个小数据试试。


SofaSofa数据科学社区DS面试题库 DS面经

数据痴汉   2017-12-13 00:53



  相关讨论

dataframe数据变long python有stata类似的命令吗

python的dataframe如何重新排列行或者列

对tuple的元素赋值时报错:'tuple' object does not support item assignment

python里的continue是什么意思

Anaconda安装wptools失败,提示找不到该包

python里的cdef是什么?

python里有没有类似excel里的那种数据透视表?

from __future__ import division是什么意思

怎么合并(串联)两个dataframe?

python里@property有什么用

  随便看看

除了PCA,还有什么降维的方法?

单一变量下的异常检测该怎么做?

返回DataFrame或者array的行数

怎么在已有的dataframe中插入一个新列(Pandas)

matplotlib一个画板上多个图叠加,如何决定图层上下?