TypeError: object of type 'NoneType' has no len()

Bug #1339439 reported by Tao Zhou
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Expired
Undecided
Unassigned

Bug Description

2014-07-09 17:31:21.408 31964 ERROR keystone.common.wsgi [-] object of type 'NoneType' has no len()
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi Traceback (most recent call last):
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/common/wsgi.py", line 207, in __call__
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi result = method(context, **params)
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/token/controllers.py", line 98, in authenticate
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi context, auth)
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/token/controllers.py", line 272, in _authenticate_local
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi password=password)
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/notifications.py", line 253, in wrapper
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi result = f(wrapped_self, context, user_id, *args, **kwargs)
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/identity/core.py", line 189, in wrapper
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi return f(self, *args, **kwargs)
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/identity/core.py", line 281, in authenticate
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi ref = driver.authenticate(user_id, password)
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/identity/backends/sql.py", line 110, in authenticate
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi user_ref = self._get_user(session, user_id)
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File "/usr/lib/python2.6/site-packages/keystone/identity/backends/sql.py", line 136, in _get_user
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi user_ref = session.query(User).get(user_id)
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File "/usr/lib64/python2.6/site-packages/sqlalchemy/orm/query.py", line 799, in get
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi if len(ident) != len(mapper.primary_key):
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi TypeError: object of type 'NoneType' has no len()
2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi

Revision history for this message
Tao Zhou (angeloudy) wrote :

        ident = util.to_list(ident)
        mapper = self._only_full_mapper_zero("get")

        if len(ident) != len(mapper.primary_key):
            raise sa_exc.InvalidRequestError(
            "Incorrect number of values in identifier to formulate "
            "primary key for query.get(); primary key columns are %s" %
            ','.join("'%s'" % c for c in mapper.primary_key))

I think lines should be added to check if ident and mapper.primary_key are none type.

Revision history for this message
Tao Zhou (angeloudy) wrote :

I first encountered this bug: https://bugs.launchpad.net/keystone/+bug/1319997
Then I update the code and encoutered this error.

user_id here is None.

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

What are the steps you're taking to recreate this?

Revision history for this message
Tao Zhou (angeloudy) wrote :

Lance,

I had the issue of 1319997 right after I installed openstack-dashboard and tried to login from dashboard.

Then I changed the code according to https://bugs.launchpad.net/keystone/+bug/1319997 and got this issue.

Revision history for this message
Morgan Fainberg (mdrnstm) wrote :

@Tao Zhou,

Can you post up your keystone.conf (please feel free to remove sensitive data)?

Is this installation Icehouse, Master? How was this deployed/installed?

Thanks for the extra info, this will help us track this down / point you in the right direction.

Revision history for this message
Tao Zhou (angeloudy) wrote : Re: [Bug 1339439] Re: TypeError: object of type 'NoneType' has no len()
Download full text (4.0 KiB)

Morgan,

Here's my keystone.conf
It's Icehouse on CentOS6.5
I installed it following this guide
http://docs.openstack.org/icehouse/install-guide/install/yum/content/

# cat /etc/keystone/keystone.conf |grep -v "^#" |grep -v "^$"
[DEFAULT]
admin_token = aa9c57cb7715a26696f4
[assignment]
[auth]
[cache]
[catalog]
[credential]
[database]
connection = mysql://keystone:KEYSTONE_DBPASS@10.1.1.116/keystone
[ec2]
[endpoint_filter]
[federation]
[identity]
[kvs]
[ldap]
[matchmaker_ring]
[memcache]
[oauth1]
[os_inherit]
[paste_deploy]
[policy]
[revoke]
[signing]
[ssl]
[stats]
[token]
[trust]

On Fri, Jul 11, 2014 at 12:54 AM, Morgan Fainberg <<email address hidden>
> wrote:

> @Tao Zhou,
>
> Can you post up your keystone.conf (please feel free to remove sensitive
> data)?
>
> Is this installation Icehouse, Master? How was this deployed/installed?
>
> Thanks for the extra info, this will help us track this down / point you
> in the right direction.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1339439
>
> Title:
> TypeError: object of type 'NoneType' has no len()
>
> Status in OpenStack Identity (Keystone):
> New
>
> Bug description:
> 2014-07-09 17:31:21.408 31964 ERROR keystone.common.wsgi [-] object of
> type 'NoneType' has no len()
> 2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi Traceback (most
> recent call last):
> 2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File
> "/usr/lib/python2.6/site-packages/keystone/common/wsgi.py", line 207, in
> __call__
> 2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi result =
> method(context, **params)
> 2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File
> "/usr/lib/python2.6/site-packages/keystone/token/controllers.py", line 98,
> in authenticate
> 2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi context,
> auth)
> 2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File
> "/usr/lib/python2.6/site-packages/keystone/token/controllers.py", line 272,
> in _authenticate_local
> 2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi
> password=password)
> 2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File
> "/usr/lib/python2.6/site-packages/keystone/notifications.py", line 253, in
> wrapper
> 2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi result =
> f(wrapped_self, context, user_id, *args, **kwargs)
> 2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File
> "/usr/lib/python2.6/site-packages/keystone/identity/core.py", line 189, in
> wrapper
> 2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi return
> f(self, *args, **kwargs)
> 2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File
> "/usr/lib/python2.6/site-packages/keystone/identity/core.py", line 281, in
> authenticate
> 2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi ref =
> driver.authenticate(user_id, password)
> 2014-07-09 17:31:21.408 31964 TRACE keystone.common.wsgi File
> "/usr/lib/python2.6/site-packages/keystone/identity/backends/sql.py", line
> 110, in authenticate
> 2014-07-09 17:31:21.408 31964 TRAC...

Read more...

Revision history for this message
Dolph Mathews (dolph) wrote :

> Then I update the code and encoutered this error.

It's not clear if this is reproducible without your change, nor is it clear what change you've made.

Changed in keystone:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Keystone because there has been no activity for 60 days.]

Changed in keystone:
status: Incomplete → Expired
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.