← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1506958] Re: TypeError: object.__new__(thread.lock) is not safe, use thread.lock.__new__()

 

Reviewed:  https://review.openstack.org/260615
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=82457f2462621b6a9c653dce2baf38d0623e25ee
Submitter: Jenkins
Branch:    master

commit 82457f2462621b6a9c653dce2baf38d0623e25ee
Author: Marian Horban <mhorban@xxxxxxxxxxxx>
Date:   Mon Dec 7 07:30:11 2015 -0500

    Replace copy.deepcopy of RequestContext with copy.copy
    
    Instance of RequestContext contains many objects and some of them like
    mutexes could not be copied. Also a deepcopy of the entire
    RequestContext wastes CPU time.
    
    To avoid problems with deepcopy and avoid performance overhead this
    patch changes deepcopy of RequestContext to shallow copy and makes
    deepcopy of only the 'roles' member because of security issue
    LP #1386932.
    
    Closes-Bug: #1506958
    Related-Bug: #1386932
    Change-Id: I1e2c00e95e1c4bcd0ec7bf075458789d6fb06e99


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1506958

Title:
  TypeError: object.__new__(thread.lock) is not safe, use
  thread.lock.__new__()

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  When using /usr/bin/nova-api, running $ openstack  availability zone
  list -> works fine.

  If using the wsgi scripts, and running nova-api via e.g. uwsgi, the
  same client command fails as following:

  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions [req-184fd1f3-ae97-49d0-85dd-05ef08800238 0e56b818bc9c4eaea4b8d6a2f5da6227 906359c0c71749ceb27e46612e0419ce - - -] Unexpected exception in API method
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions Traceback (most recent call last):
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/api/openstack/extensions.py", line 478, in wrapped
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions     return f(*args, **kwargs)
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/availability_zone.py", line 115, in detail
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions     return self._describe_availability_zones_verbose(context)
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/api/openstack/compute/availability_zone.py", line 61, in _describe_availability_zones_verbose
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions     ctxt = context.elevated()
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/site-packages/nova/context.py", line 198, in elevated
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions     context = copy.deepcopy(self)
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/copy.py", line 190, in deepcopy
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions     y = _reconstruct(x, rv, 1, memo)
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/copy.py", line 334, in _reconstruct
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions     state = deepcopy(state, memo)
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions     y = copier(x, memo)
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/copy.py", line 257, in _deepcopy_dict
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions     y[deepcopy(key, memo)] = deepcopy(value, memo)
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/copy.py", line 190, in deepcopy
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions     y = _reconstruct(x, rv, 1, memo)
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/copy.py", line 334, in _reconstruct
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions     state = deepcopy(state, memo)
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/copy.py", line 163, in deepcopy
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions     y = copier(x, memo)
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/copy.py", line 257, in _deepcopy_dict
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions     y[deepcopy(key, memo)] = deepcopy(value, memo)
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/copy.py", line 190, in deepcopy
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions     y = _reconstruct(x, rv, 1, memo)
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/copy.py", line 329, in _reconstruct
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions     y = callable(*args)
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions   File "/usr/lib/python2.7/copy_reg.py", line 93, in __newobj__
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions     return cls.__new__(cls, *args)
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions TypeError: object.__new__(thread.lock) is not safe, use thread.lock.__new__()
  2015-10-16 16:58:20.720 18938 ERROR nova.api.openstack.extensions
  2015-10-16 16:58:20.721 18938 INFO nova.api.openstack.wsgi [req-184fd1f3-ae97-49d0-85dd-05ef08800238 0e56b818bc9c4eaea4b8d6a2f5da6227 906359c0c71749ceb27e46612e0419ce - - -] HTTP exception thrown: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
  <type 'exceptions.TypeError'>

  
  Looks like a dejavu of https://bugs.launchpad.net/python-novaclient/+bug/1123561 but I am not certain.

  This is with liberty final release (or so i believe at the moment).

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1506958/+subscriptions


References