pecan path leaves policy engine uninitialized

Bug #1671267 reported by Kevin Benton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Kevin Benton

Bug Description

Traceback in pecan gate run. http://logs.openstack.org/35/393535/25/check/gate-grenade-dsvm-neutron-ubuntu-xenial/9867d01/logs/new/screen-q-svc.txt.gz

2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors Traceback (most recent call last):
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/oslo_middleware/catch_errors.py", line 41, in __call__
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors response = req.get_response(self.application)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors application, catch_exc_info=False)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors app_iter = application(self.environ, start_response)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors resp = self.call_func(req, *args, **self.kwargs)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors return self.func(req, *args, **kwargs)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/keystonemiddleware/auth_token/__init__.py", line 335, in __call__
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors response = req.get_response(self._app)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors application, catch_exc_info=False)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors app_iter = application(self.environ, start_response)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors return resp(environ, start_response)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors return resp(environ, start_response)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/routes/middleware.py", line 141, in __call__
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors response = self.app(environ, start_response)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors return resp(environ, start_response)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/pecan/middleware/recursive.py", line 56, in __call__
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors return self.application(environ, start_response)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/pecan/core.py", line 840, in __call__
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors return super(Pecan, self).__call__(environ, start_response)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/pecan/core.py", line 736, in __call__
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors state
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/pecan/core.py", line 865, in handle_hooks
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors return super(Pecan, self).handle_hooks(hooks, *args, **kw)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/usr/local/lib/python2.7/dist-packages/pecan/core.py", line 342, in handle_hooks
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors result = getattr(hook, hook_type)(*args)
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/opt/stack/new/neutron/neutron/pecan_wsgi/hooks/policy_enforcement.py", line 185, in after
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors pluralized=collection))]
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors File "/opt/stack/new/neutron/neutron/policy.py", line 368, in check
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors result = _ENFORCER.enforce(match_rule,
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors AttributeError: 'NoneType' object has no attribute 'enforce'
2017-03-08 17:32:36.121 23954 ERROR oslo_middleware.catch_errors

Changed in neutron:
assignee: nobody → Kevin Benton (kevinbenton)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

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

Changed in neutron:
status: New → In Progress
tags: added: api
Changed in neutron:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/443342
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=4c40016dfba21a851d1cac5ce199ddcca001562b
Submitter: Jenkins
Branch: master

commit 4c40016dfba21a851d1cac5ce199ddcca001562b
Author: Kevin Benton <email address hidden>
Date: Wed Mar 8 14:43:28 2017 -0800

    Init policy in pecan after hook as well

    policy.init() is called in the before hook, but this isn't
    invoked on GET calls so if the first call a thread receives
    is a GET call, we can end up with an uninitialized policy
    enforcer and get a traceback.

    This just calls policy.init() in the after hook as well.

    Change-Id: I29ebc9a91b98a27e707d5b35ad1a24a26e8c8f44
    Closes-Bug: #1671267

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 11.0.0.0b1

This issue was fixed in the openstack/neutron 11.0.0.0b1 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/ocata)

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/460913

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/460915

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/ocata)

Reviewed: https://review.openstack.org/460913
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=816ccb35b436ef793d23749c7017e362ec815838
Submitter: Jenkins
Branch: stable/ocata

commit 816ccb35b436ef793d23749c7017e362ec815838
Author: Kevin Benton <email address hidden>
Date: Wed Mar 8 14:43:28 2017 -0800

    Init policy in pecan after hook as well

    policy.init() is called in the before hook, but this isn't
    invoked on GET calls so if the first call a thread receives
    is a GET call, we can end up with an uninitialized policy
    enforcer and get a traceback.

    This just calls policy.init() in the after hook as well.

    Change-Id: I29ebc9a91b98a27e707d5b35ad1a24a26e8c8f44
    Closes-Bug: #1671267
    (cherry picked from commit 4c40016dfba21a851d1cac5ce199ddcca001562b)

tags: added: in-stable-ocata
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (stable/newton)

Change abandoned by Jakub Libosvar (<email address hidden>) on branch: stable/newton
Review: https://review.openstack.org/460915
Reason: Abandoning per comments

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 10.0.2

This issue was fixed in the openstack/neutron 10.0.2 release.

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.