Comment 1 for bug 1365901

Revision history for this message
Zhikun Liu (zhikunliu) wrote :

> /usr/lib/python2.6/site-packages/cinder/wsgi.py(178)__init__()
(Pdb) l
173 "after trying for 30 seconds") %
174 {'host': host, 'port': port})
175
176 (self._host, self._port) = self._socket.getsockname()[0:2]
177 import pdb;pdb.set_trace()
178 -> LOG.info(_("%(name)s listening on %(_host)s:%(_port)s")
179 % self.__dict__)
180
181 def start(self):
182 """Start serving a WSGI application.
183
(Pdb) self.__dict__
{'_use_ssl': None, 'name': 'osapi_volume', '_logger': <cinder.openstack.common.log.ContextAdapter instance at 0x3755e18>, 'app': {(None, ''): <cinder.api.middleware.fault.FaultWrapper object at 0x50d1390>, (None, '/v1'): <cinder.openstack.common.middleware.request_id.RequestIdMiddleware object at 0x50d0c50>, (None, '/v2'): <cinder.openstack.common.middleware.request_id.RequestIdMiddleware object at 0x4de8ed0>}, '_socket': <eventlet.greenio.GreenSocket object at 0x3760790>, '_pool': <eventlet.greenpool.GreenPool object at 0x3754f10>, '_port': 8776, '_wsgi_logger': <cinder.openstack.common.log.WritableLogger object at 0x3754f90>, '_protocol': <class eventlet.wsgi.HttpProtocol at 0x3355ef0>, '_host': '0.0.0.0', '_server': None, 'pool_size': 1000}
(Pdb) c
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.AttributeError'> ignored
....

Above LOG.info fucntion calls i18n message to deep copy each value in self.__dict__which includes a socket object.

> /usr/lib/python2.6/site-packages/oslo/i18n/_message.py(134)_sanitize_mod_params()
-> if isinstance(self.params, dict):
(Pdb) l
129 params = (other,)
130 elif isinstance(other, dict):
131 # Merge the dictionaries
132 # Copy each item in case one does not support deep copy.
133 params = {}
134 if isinstance(self.params, dict):
135 params.update((key, self._copy_param(val))
136 for key, val in self.params.items())
137 -> params.update((key, self._copy_param(val))
138 for key, val in other.items())
139 else:
(Pdb)

In python2.6 copy.deepcopy() a sokect object will raise "Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.AttributeError'> ignored", this causes the hang loop of cinder-api.
But in python2.7, it does not have any errors.

we don't need pass self.__dict__ into the LOG function, use instance's properties directly could fix the problem.