← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1681843] Re: Nova-placement returns "ValueError: invalid literal for int() with base 10: ''"

 

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

commit d8be75b3b8d80598dd6375a8c029fe9906e00b9f
Author: Andy McCrae <andy.mccrae@xxxxxxxxx>
Date:   Tue Apr 11 14:19:44 2017 +0100

    Allow CONTENT_LENGTH to be present but empty
    
    The CONTENT_LENGTH environ can be present, but empty, which returns
    None, and causes a ValueError when attempting to use .int().
    
    This patch removes the setting of CONTENT_LENGTH to an integer, but
    instead ensures that if CONTENT_LENGTH is not empty it is an integer, to
    prevent a situation where a bogus "CONTENT_LENGTH" header is specified.
    
    Additionally, as the CONTENT_TYPE environ can similarly be present but
    empty, we should .get() it in a similar fashion to ensure it isn't
    present but None when CONTENT_LENGTH is specified.
    
    Change-Id: I66b6f9afbea8bf037997a59ba0b976f83c9825fb
    Closes-Bug: #1681843


** 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/1681843

Title:
  Nova-placement returns "ValueError: invalid literal for int() with
  base 10: ''"

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  Since
  https://github.com/openstack/nova/commit/6dd047a3307a1056077608fd5bc2d1c3b3285338
  we're seeing errors for Nova-placement service in the OpenStack-
  Ansible gate jobs:

  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack [req-a9cb7079-b603-4c2c-9f99-8bc4293f9700 78e46f12329c4f71a7f6b97aa3a7eb57 f7d6ca89f4fb446eaebef93f7f235a50 - default default] Caught error: invalid literal for int() with base 10: ''
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack Traceback (most recent call last):
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack   File "/openstack/venvs/nova-master/lib/python2.7/site-packages/nova/api/openstack/__init__.py", line 85, in __call__
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack     return req.get_response(self.application)
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack   File "/openstack/venvs/nova-master/lib/python2.7/site-packages/webob/request.py", line 1316, in send
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack     application, catch_exc_info=False)
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack   File "/openstack/venvs/nova-master/lib/python2.7/site-packages/webob/request.py", line 1280, in call_application
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack     app_iter = application(self.environ, start_response)
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack   File "/openstack/venvs/nova-master/lib/python2.7/site-packages/webob/dec.py", line 131, in __call__
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack     resp = self.call_func(req, *args, **self.kwargs)
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack   File "/openstack/venvs/nova-master/lib/python2.7/site-packages/webob/dec.py", line 196, in call_func
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack     return self.func(req, *args, **kwargs)
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack   File "/openstack/venvs/nova-master/lib/python2.7/site-packages/nova/api/openstack/placement/microversion.py", line 123, in __call__
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack     response = req.get_response(self.application)
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack   File "/openstack/venvs/nova-master/lib/python2.7/site-packages/webob/request.py", line 1316, in send
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack     application, catch_exc_info=False)
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack   File "/openstack/venvs/nova-master/lib/python2.7/site-packages/webob/request.py", line 1280, in call_application
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack     app_iter = application(self.environ, start_response)
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack   File "/openstack/venvs/nova-master/lib/python2.7/site-packages/nova/api/openstack/placement/handler.py", line 182, in __call__
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack     if int(environ.get('CONTENT_LENGTH', 0)):
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack ValueError: invalid literal for int() with base 10: ''
  2017-04-10 17:43:45.761 2477 ERROR nova.api.openstack 

  ================================

  The Error is occurring because "CONTENT_LENGTH" is present but = ''
  and the change attempts to set "None" to an int - which fails.

  We're using Nginx /w uWSGI and I believe a default uwsgi param is set
  to always send a CONTENT_LENGTH and CONTENT_TYPE header even when
  those are empty.

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


References