← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1409774] Re: sqlalchemy session needs to be rolled back after catching a db exception

 

[Expired for neutron because there has been no activity for 60 days.]

** Changed in: neutron
       Status: Incomplete => Expired

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1409774

Title:
  sqlalchemy session needs to be rolled back after catching a db
  exception

Status in neutron:
  Expired

Bug description:
  To avoid errors like this:

  sqlalchemy.exc.InvalidRequestError: This Session's transaction has
  been rolled back by a nested rollback() call.  To begin a new
  transaction, issue Session.rollback() first

  the sqlalchemy session needs to be rolled back after catching a db
  exception in a transaction, see sqlalchemy faq
  http://docs.sqlalchemy.org/en/rel_0_8/faq.html#this-session-s
  -transaction-has-been-rolled-back-due-to-a-previous-exception-during-
  flush-or-similar . There are places in Neutron code where a db
  exception is caught and the session is not properly rolled back. As
  explained in the sqlalchemy faq, this is the right way:

  try:
  <use session>
  session.commit()
  except:
  session.rollback()
  raise
  finally:
  session.close() # optional, depends on use case

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


References