yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #48084
[Bug 1557546] [NEW] Correct usage of context manager for transactions
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
Follow ups