Public bug reported: When we working with transaction we should use context manager as if exception appears transaction can hang. The code like:
context.session.begin(subtransactions=True) ... try: context.session.add(binding) context.session.commit() except db_exc.DBDuplicateEntry: context.session.rollback() is not safe becuase if another exception, not DBDuplicateEntry will be raised, transaction will hang. ** Affects: neutron Importance: Low Assignee: Ann Kamyshnikova (akamyshnikova) Status: New ** Tags: db ** Changed in: neutron Importance: Undecided => Low -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1557546 Title: Correct usage of context manager for transactions Status in neutron: New Bug description: When we working with transaction we should use context manager as if exception appears transaction can hang. The code like: context.session.begin(subtransactions=True) ... try: context.session.add(binding) context.session.commit() except db_exc.DBDuplicateEntry: context.session.rollback() is not safe becuase if another exception, not DBDuplicateEntry will be raised, transaction will hang. To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1557546/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp