object of type 'NoneType' has no len when tokens expire

Bug #1319997 reported by Robert Collins
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Medium
Chris Jones

Bug Description

When an expired UUID token is used the following is logged in keystone.log:

       2014-05-15 07:08:01.040 31086 ERROR keystone.common.wsgi [-] object of type 'NoneType' has no len()
2014-05-15 07:08:01.040 31086 TRACE keystone.common.wsgi Traceback (most recent call last):
2014-05-15 07:08:01.040 31086 TRACE keystone.common.wsgi File "/opt/stack/venvs/keystone/local/lib/python2.7/site-packages/keystone/common/wsgi.py", line 207, in __call__
2014-05-15 07:08:01.040 31086 TRACE keystone.common.wsgi result = method(context, **params)
2014-05-15 07:08:01.040 31086 TRACE keystone.common.wsgi File "/opt/stack/venvs/keystone/local/lib/python2.7/site-packages/keystone/token/controllers.py", line 98, in authenticate
2014-05-15 07:08:01.040 31086 TRACE keystone.common.wsgi context, auth)
2014-05-15 07:08:01.040 31086 TRACE keystone.common.wsgi File "/opt/stack/venvs/keystone/local/lib/python2.7/site-packages/keystone/token/controllers.py", line 256, in _authenticate_local
2014-05-15 07:08:01.040 31086 TRACE keystone.common.wsgi if len(username) > CONF.max_param_size:
2014-05-15 07:08:01.040 31086 TRACE keystone.common.wsgi TypeError: object of type 'NoneType' has no len()

This is fairly noisy for a normal situation.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/93801

Changed in keystone:
assignee: nobody → Chris Jones (cmsj)
status: New → In Progress
Dolph Mathews (dolph)
Changed in keystone:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/93801
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=0ba5334811e04a46d0ebe4f6f44d153e2ab77ce0
Submitter: Jenkins
Branch: master

commit 0ba5334811e04a46d0ebe4f6f44d153e2ab77ce0
Author: Chris Jones <email address hidden>
Date: Thu May 15 16:39:09 2014 -0400

    Reduce log noise on expired tokens

    If a token has expired, we now check the username field exists before
    trying to len() it, thus reducing log noise.

    Change-Id: Ie463607e4fb7ca671f9dad5559b87fe7721be4bd
    Closes-Bug: #1319997

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
milestone: none → juno-1
status: Fix Committed → Fix Released
Revision history for this message
Tao Zhou (angeloudy) wrote :

The fix doesn't solve the issue for me.
After I added the check for username, I encountered the error below:

  user_ref = session.query(User).get(user_id)
2014-07-09 17:48:16.723 34040 TRACE keystone.common.wsgi File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/query.py", line 805, in get
2014-07-09 17:48:16.723 34040 TRACE keystone.common.wsgi if len(ident) != len(mapper.primary_key):
2014-07-09 17:48:16.723 34040 TRACE keystone.common.wsgi TypeError: object of type 'NoneType' has no len()

This is because username is None, which results in a None user_id.
The problem is why username is None.

Revision history for this message
Lance Bragstad (lbragstad) wrote :

More information regarding the above comment here:

https://bugs.launchpad.net/keystone/+bug/1340041

Revision history for this message
Lance Bragstad (lbragstad) wrote :

I linked the wrong bug above, more information on comment #3 here:

https://bugs.launchpad.net/keystone/+bug/1339439

Thierry Carrez (ttx)
Changed in keystone:
milestone: juno-1 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.