Problems with password reset

Issue #572 resolved
Former user created an issue

I'm trying to reset the user password using /_admin/password_reset. I get the message "Your password reset link was sent" but no email is send. The email configuration seems to be correct as the paste error are being sent.

I've enabled full logging and discovered that it seems to be the celery task failing. Below is the interesting part of the logs:

{{{ #!python

INFO [rhodecode.lib.celerylib] running task 938eba22-42c1-4648-b561-95fc45ec037c:<@task: rhodecode.lib.celerylib.tasks.send_password_link> DEBUG [pylons.controllers.util] Generating 302 redirect DEBUG [pylons.controllers.core] 'password_reset' method raised HTTPException: HTTPFound (code: 302) Traceback (most recent call last): File "/opt/rhodecode-virtenv/local/lib/python2.7/site-packages/pylons/controllers/core.py", line 105, in _inspect_call result = self._perform_call(func, args) File "/opt/rhodecode-virtenv/local/lib/python2.7/site-packages/pylons/controllers/core.py", line 57, in _perform_call return func(**args) File "/opt/rhodecode-virtenv/local/lib/python2.7/site-packages/rhodecode/controllers/login.py", line 166, in password_reset return redirect(url('login_home')) File "/opt/rhodecode-virtenv/local/lib/python2.7/site-packages/pylons/controllers/util.py", line 208, in redirect raise exc(location=url).exception HTTPFound: The resource was found at

}}}

Comments (18)

  1. Marcin Kuzminski repo owner

    The exception is normal, this is how pylons handle redirections, are you using celery server ? maybe the problem is there

  2. Paweł Widera

    Yes, I had the celery upstart service misconfigured and I couldn't see any logs. Now it's working and I get the following error from celery:

    [2012-09-26 20:00:21,877: ERROR/PoolWorker-2] rhodecode.lib.celerylib.tasks.send_password_link[27f561ab-857e-4b28-8bc7-7141ad958004]: Traceback (most recent call last):
      File "/opt/rhodecode-virtenv/local/lib/python2.7/site-packages/rhodecode/lib/celerylib/tasks.py", line 262, in send_password_link
        qualified=True)
      File "/opt/rhodecode-virtenv/local/lib/python2.7/site-packages/paste/registry.py", line 155, in __call__
        return self._current_obj()(*args, **kw)
      File "/opt/rhodecode-virtenv/local/lib/python2.7/site-packages/paste/registry.py", line 197, in _current_obj
        'thread' % self.____name__)
    TypeError: No object (name: url) has been registered for this thread
    
  3. Paweł Widera

    I'm using paster in the upstart script like this:

    env PID_FILE=/run/celeryd/pid
    env LOG_FILE=/var/log/celeryd/celeryd.log
    env CONFIG=/var/lib/rhodecode/production.ini
    env APP=/opt/rhodecode-virtenv/bin/paster
    
    pre-start script
    	mkdir -p /run/celeryd
    	chown rhodecode:rhodecode /run/celeryd
    end script
    
    exec sudo -u rhodecode -g rhodecode $APP celeryd $CONFIG --pidfile=$PID_FILE --logfile=$LOG_FILE
    
  4. Paweł Widera

    Here is a bit more detailed log from celery with DEBUG level enabled:

    [2012-10-01 15:25:45,763: DEBUG/MainProcess] Consumer: Ready to accept tasks!
    [2012-10-01 15:26:13,746: INFO/MainProcess] Got task from broker: rhodecode.lib.celerylib.tasks.send_password_link[30856c01-b5ae-475a-a799-7232ce87ec82]
    [2012-10-01 15:26:13,758: DEBUG/MainProcess] Mediator: Running callback for task: rhodecode.lib.celerylib.tasks.send_password_link[30856c01-b5ae-475a-a799-7232ce87ec82]
    [2012-10-01 15:26:13,758: DEBUG/MainProcess] TaskPool: Apply <function execute_and_trace at 0x41c29b0> (args:('rhodecode.lib.celerylib.tasks.send_password_link', '30856c01-b5ae-475a-a799-7232ce87ec82', (u'user@host.com',), {}) kwargs:{'hostname': 'xxx', 'request': {'retries': 0, 'loglevel': 10, 'delivery_info': {'consumer_tag': u'2', 'routing_key': u'celery', 'exchange': u'celery'}, 'is_eager': False, 'taskset': None, 'logfile': '/var/log/celeryd/celeryd.log', 'id': '30856c01-b5ae-475a-a799-7232ce87ec82'}})
    [2012-10-01 15:26:13,759: DEBUG/MainProcess] Task accepted: rhodecode.lib.celerylib.tasks.send_password_link[30856c01-b5ae-475a-a799-7232ce87ec82] pid:27788
    [2012-10-01 15:26:13,780: INFO/PoolWorker-2] initializing db for Engine(postgresql://user:password@localhost/rhodecode)
    [2012-10-01 15:26:13,859: DEBUG/PoolWorker-2] rhodecode.lib.celerylib.tasks.send_password_link[30856c01-b5ae-475a-a799-7232ce87ec82]: password reset user found <User('id:2:username')>
    [2012-10-01 15:26:13,860: ERROR/PoolWorker-2] rhodecode.lib.celerylib.tasks.send_password_link[30856c01-b5ae-475a-a799-7232ce87ec82]: Traceback (most recent call last):
      File "/opt/rhodecode-virtenv/local/lib/python2.7/site-packages/rhodecode/lib/celerylib/tasks.py", line 262, in send_password_link
        qualified=True)
      File "/opt/rhodecode-virtenv/local/lib/python2.7/site-packages/paste/registry.py", line 155, in __call__
        return self._current_obj()(*args, **kw)
      File "/opt/rhodecode-virtenv/local/lib/python2.7/site-packages/paste/registry.py", line 197, in _current_obj
        'thread' % self.____name__)
    TypeError: No object (name: url) has been registered for this thread
    
    [2012-10-01 15:26:13,860: DEBUG/PoolWorker-2] worker exiting after 1 tasks
    [2012-10-01 15:26:13,861: INFO/PoolWorker-2] process shutting down
    [2012-10-01 15:26:13,861: INFO/MainProcess] Task rhodecode.lib.celerylib.tasks.send_password_link[30856c01-b5ae-475a-a799-7232ce87ec82] succeeded in 0.101703882217s: False
    
  5. Marcin Kuzminski repo owner

    I'd seen that errors somewhere before but it was due to bad initialization of celery, that didn't register properly pylons stack, and things failed. Maybe try with new virtualenv ?

  6. Paweł Widera

    I've tried again in fresh environment:

    $ mkdir rc-env
    $ virtualenv --no-site-packages rc-env/
    $ cp /var/lib/rhodecode/production.ini .
    $ source rc-env/bin/activate
    ^C(rc-env)$ paster celeryd production.ini 2&> celery.log &
    ^C(rc-env)$ paster serve production.ini 2&> server.log &
    

    An attempt to reset a password still ends with the exception above.

  7. ducktayp

    I've also run into this problem, and it's preventing me from using rhodecode with celery. I'm running rhodecode 1.5.3 on a fresh virtualenv. (if it matters, I'm running on an Ubuntu 12.0.4.2 system and rhodecode is setup behind an Apache reverse proxy).

    Sending a test email does work with celery enabled, and if I disable celery everything works.

    Following a suggestion I found here: https://groups.google.com/forum/?fromgroups=#!topic/rhodecode/4EW8SYMfJv4 I tried setting "celeryd.pool = threads" in the configuration file, but this did not solve the problem.

    Any ideas?

  8. ducktayp

    Excellent. Thanks! BTW -- can I apply the diff to a production 1.5.3 version, or will it break something? (I assume this fix is in commit 5c310b7)

  9. Marcin Kuzminski repo owner

    it should be safe to cherry-pick it. I have to release a new version anyway i'll sync that to stable in a 1-2 days.

  10. Paweł Widera

    I have just upgraded to 1.5.4 and test it. The password reset problem is fixed indeed. Thanks!

  11. Log in to comment