AttributeError: 'RequestContext' object has no attribute 'user_id'

Bug #1427665 reported by Davanum Srinivas (DIMS)
36
This bug affects 6 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Low
Unassigned
oslo.log
Invalid
Undecided
Unassigned

Bug Description

Example from:
http://logs.openstack.org/47/122347/16/check/check-tempest-dsvm-full/e958fa0/logs/screen-n-cpu.txt.gz

Traceback (most recent call last):
  File "/usr/lib/python2.7/logging/__init__.py", line 851, in emit
    msg = self.format(record)
  File "/usr/local/lib/python2.7/dist-packages/oslo_log/handlers.py", line 69, in format
    return logging.StreamHandler.format(self, record)
  File "/usr/lib/python2.7/logging/__init__.py", line 724, in format
    return fmt.format(record)
  File "/usr/local/lib/python2.7/dist-packages/oslo_log/formatters.py", line 178, in format
    context = _update_record_with_context(record)
  File "/usr/local/lib/python2.7/dist-packages/oslo_log/formatters.py", line 56, in _update_record_with_context
    d = _dictify_context(context)
  File "/usr/local/lib/python2.7/dist-packages/oslo_log/formatters.py", line 31, in _dictify_context
    context = context.to_dict()
  File "/opt/stack/new/nova/nova/context.py", line 157, in to_dict
    values.update({'user_id': self.user_id,
AttributeError: 'RequestContext' object has no attribute 'user_id'
Logged from file context.py, line 97

Changed in nova:
assignee: nobody → Davanum Srinivas (DIMS) (dims-v)
status: New → In Progress
Revision history for this message
Guangya Liu (Jay Lau) (jay-lau-513) wrote :
Changed in nova:
importance: Undecided → High
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/160535
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=7a4136df187fc6d2f5813580e8868e591007c2e8
Submitter: Jenkins
Branch: master

commit 7a4136df187fc6d2f5813580e8868e591007c2e8
Author: Davanum Srinivas <email address hidden>
Date: Mon Mar 2 17:19:44 2015 -0500

    Better round trip for RequestContext<->Dict conversion

    Conversion of nova.context.RequestContext to and from a
    dictionary was not working properly. There is duplicate
    information as well in the serialized dict. As a first
    step i've removed request_id as it dups the one in
    oslo_context.RequestContext. However changing project_id
    and user_id to a @property is challenging at this late
    juncture. So leaving them as-is with a FIXME. The other
    issue related to the roundtrip is the stack traces that
    show up in screen-n-cpu log as mentioned in the bug
    referenced below. To avoid that added some defensive
    code ('has_attr') for now and a FIXME.

    Partial-Bug: #1427665
    Change-Id: Ia47d4909d2656d6fc4c1179659b8098bba3235d3

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

There are a few FIXME's in the changeset. need to revisit

Changed in nova:
importance: High → Low
Changed in nova:
status: In Progress → Confirmed
Changed in nova:
assignee: Davanum Srinivas (DIMS) (dims-v) → nobody
Changed in nova:
status: Confirmed → Invalid
Changed in oslo.log:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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