Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset_keys view can timeout. #12

Open
dvogel opened this issue Jul 24, 2014 · 6 comments
Open

reset_keys view can timeout. #12

dvogel opened this issue Jul 24, 2014 · 6 comments

Comments

@dvogel
Copy link
Contributor

dvogel commented Jul 24, 2014

The reset_keys method queues thousands of jobs. It should queue a single job that then queues the thousands of jobs.

https://github.com/sunlightlabs/django-locksmith/blob/master/locksmith/hub/views.py#L57-L78

@dcloud
Copy link

dcloud commented Jul 24, 2014

👊

@timball
Copy link
Member

timball commented Jul 25, 2014

drew claims that this is al good, tn but trying to reset the capwords keys again and i keep getting this AND the one dude's key isn't getting synced so badness/magic/sadness ? don't care ate korean last night...

--timball

(capwords)capwords@southwest:~/src/Capitol-Words/cwod_site$ python ./manage.py resetkeys
resetting all keys for capitolwords
Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_manager(settings)
  File "/projects/capwords/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/projects/capwords/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/projects/capwords/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/projects/capwords/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/projects/capwords/lib/python2.6/site-packages/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/projects/capwords/lib/python2.6/site-packages/locksmith/auth/management/commands/resetkeys.py", line 16, in handle_noargs
    api=settings.LOCKSMITH_API_NAME)
  File "/projects/capwords/lib/python2.6/site-packages/locksmith/common.py", line 53, in apicall
    urllib2.urlopen(url, body)
  File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.6/urllib2.py", line 397, in open
    response = meth(req, response)
  File "/usr/lib/python2.6/urllib2.py", line 510, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.6/urllib2.py", line 435, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.6/urllib2.py", line 518, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 502: Bad Gateway

@timball
Copy link
Member

timball commented Jul 25, 2014

this demonstrates a nearly exactly 30s timeout .

--timball

(capwords)capwords@southwest:~/src/Capitol-Words/cwod_site$ time python ./manage.py resetkeys
resetting all keys for capitolwords
Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_manager(settings)
  File "/projects/capwords/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/projects/capwords/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/projects/capwords/lib/python2.6/site-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/projects/capwords/lib/python2.6/site-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/projects/capwords/lib/python2.6/site-packages/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/projects/capwords/lib/python2.6/site-packages/locksmith/auth/management/commands/resetkeys.py", line 16, in handle_noargs
    api=settings.LOCKSMITH_API_NAME)
  File "/projects/capwords/lib/python2.6/site-packages/locksmith/common.py", line 53, in apicall
    urllib2.urlopen(url, body)
  File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.6/urllib2.py", line 397, in open
    response = meth(req, response)
  File "/usr/lib/python2.6/urllib2.py", line 510, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.6/urllib2.py", line 435, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.6/urllib2.py", line 518, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 502: Bad Gateway

real    0m31.152s
user    0m0.280s
sys 0m0.170s

@timball
Copy link
Member

timball commented Jul 25, 2014

mayhaps related to this > https://app.getsentry.com/sunlightlabs/sunlightfoundationcom/group/26744887/#exception

Can't retry locksmith.hub.tasks.replicate_key[36a01bef-49e7-41b8-9b3a-cc74a0781901] args:(<Key: API_KEY [email protected] [A]>, <Api: capitolwords>) kwargs:{}

locksmith/hub/tasks.py ? in replicate_key (application)

             'k': str(key.key),
            'e': str(e.read()) if isinstance(e, urllib2.HTTPError) else str(e)
        }
        print 'Caught exception while pushing key {k} to {a}: {e}'.format(**ctx)
        print 'Will retry'
        replicate_key.retry()

@boblannon
Copy link
Contributor

having this issue on IE right now. did we ever come up with a solution? paging @timball

@timball
Copy link
Member

timball commented Oct 3, 2014

uh don't thinks so . I'm not really near the network ... uh hrm .

--timball

please pardom the two thumbed typist
On Oct 3, 2014 6:12 PM, "Bob Lannon" [email protected] wrote:

having this issue on IE right now. did we ever come up with a solution?
paging @timball https://github.com/timball


Reply to this email directly or view it on GitHub
#12 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants