ProgrammingError: You have an error in your SQL syntax 'INSERT INTO meteringlabels'

Bug #1358147 reported by George Shuklin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Cloud Archive
Won't Fix
Low
Unassigned
neutron
Invalid
Low
Unassigned
neutron (Ubuntu)
Invalid
Low
Unassigned

Bug Description

Installation works about few months, got this message in logstash. Happens once, there is no surrounding activity (no requests to API).

Havanna, ubuntu-cloud-archive, 2013.2.3-0ubuntu1.1

Aug 17 21:48:59 api1 neutron.openstack.common.db.sqlalchemy.session[12400]: ERROR DB exception wrapped.
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/neutron/openstack/common/db/sqlalchemy/session.py", line 524, in _wrap
    return f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/neutron/openstack/common/db/sqlalchemy/session.py", line 718, in flush
    return super(Session, self).flush(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 1818, in flush
    self._flush(objects)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 1936, in _flush
    transaction.rollback(_capture_exception=True)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/util/langhelpers.py", line 58, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 1900, in _flush
    flush_context.execute()
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 372, in execute
    rec.execute(self)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 525, in execute
    uow
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 64, in save_obj
    table, insert)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 541, in _emit_insert_statements
    execute(statement, multiparams)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 662, in execute
    params)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 761, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 874, in _execute_context
    context)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1024, in _handle_dbapi_exception
exc_info
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 195, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 867, in _execute_context

    context)
  File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 324, in do_execute
    cursor.execute(statement, parameters)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue

ProgrammingError: (ProgrammingError) (1064, 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \': "\'eaa6e8e248ce4f3784282b0c3f51384a\'", u\'created_at\': "\'2014-08-05T06:34:28+00:\' at line 1') 'INSERT INTO meteringlabels (tenant_id, id, name, description) VALUES (%s, %s, %s, %s)' ({u'keystone_tenant_id': u'eaa6e8e248ce4f3784282b0c3f51384a', u'created_at': u'2014-08-05T06:34:28+00:00', u'updated_at': u'2014-08-05T06:34:28+00:00', u'admin_blocked': False, u'id': 817, u'blocked': False}, '81070432-d514-4606-b564-e7f76138d985', 'billable', '')

Tags: api metering
description: updated
Revision history for this message
Eugene Nikanorov (enikanorov) wrote :

From the trace it still looks like malformed user request was handled and led to such trace.

I think more data needed to investigate this further, hence marking as incomplete for neutron

tags: added: api metering
Changed in neutron:
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
George Shuklin (george-shuklin) wrote :

What kind of data do you need? That installation is still running, I can gather it.

Revision history for this message
James Page (james-page) wrote :

2013.2 (havana) is no longer supported by Canonical in the Cloud Archive so marking 'Won't Fix'; leaving main distro task open.

Changed in neutron (Ubuntu):
importance: Undecided → Low
Changed in cloud-archive:
importance: Undecided → Low
status: New → Won't Fix
Revision history for this message
Angus Lees (gus) wrote :

Fwiw, I agree with enikanorov's assessment. It looks like the first value (tenant_id) is mistakenly a python dict instead of the expected simple string.

Having stared at the relevant piece of havana-eol code (neutron.db.metering.metering_db.MeteringDbMixin.create_metering_label()) and traced the value of tenant_id backwards several callers, this value is whatever the user passed in the 'tenant_id' json key in the create_metering_label REST API request.

This functions is restricted to admin only, so you're probably looking for either a neutron cli tool or heat bug, or perhaps some local admin (mis)using neutronclient or the API directly.

Since it has only happened once, I think this is as far as we're going to go - if you see this recur, then we need more information about who/what made the relevant REST call.

Changed in neutron:
status: Incomplete → Invalid
Changed in neutron (Ubuntu):
status: New → Invalid
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.