benoitc/couchdbkit

MaxRetriesError under heavy concurrent load

Closed this issue · 2 comments

Running 64 threads hitting couchdbkit pretty hard (all they do is cycle through URLs) I'm getting the back trace down below. Each thread creates its own instances of Server and I'm not sharing any of the "sub" instances of database or anything so I don't think its anything I'm doing.

Traceback (most recent call last):
  File "./data_report.py", line 215, in load_user_dbs
    dbs = srv.all_dbs()
  File "/usr/local/lib/python2.6/dist-packages/couchdbkit-0.6.1-py2.6.egg/couchdbkit/client.py", line 122, in all_dbs
    return self.res.get('/_all_dbs').json_body
  File "/usr/local/lib/python2.6/dist-packages/restkit-4.1.2-py2.6.egg/restkit/resource.py", line 114, in get
    params_dict=params_dict, **params)
  File "./data_report.py", line 69, in request
    return super(Resource, self).request(*args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/couchdbkit-0.6.1-py2.6.egg/couchdbkit/resource.py", line 111, in request
    payload=payload, headers=headers, **params)
  File "/usr/local/lib/python2.6/dist-packages/restkit-4.1.2-py2.6.egg/restkit/resource.py", line 190, in request
    headers=self.make_headers(headers))
  File "/usr/local/lib/python2.6/dist-packages/restkit-4.1.2-py2.6.egg/restkit/client.py", line 412, in request
    return self.perform(request)
  File "/usr/local/lib/python2.6/dist-packages/restkit-4.1.2-py2.6.egg/restkit/client.py", line 298, in perform
    conn = self.get_connection(request)
  File "/usr/local/lib/python2.6/dist-packages/restkit-4.1.2-py2.6.egg/restkit/client.py", line 187, in get_connection
    extra_headers=extra_headers, **self.ssl_args)
  File "/usr/local/lib/python2.6/dist-packages/socketpool-0.3.0-py2.6.egg/socketpool/pool.py", line 124, in get
    raise MaxTriesError()
MaxTriesError

Also, I hacked socketpool in place to use a max of 100 connections to see if it was just 64 threads exhausting the default of 10 or w/e and that didn't fix it. Random first guess is that socketpool is leaking connections somehow.

Never mind. The bug is in restkit. Opening an issue there.