Am 07.06.2011 12:47, schrieb Jan Pazdziora:
On Fri, Jun 03, 2011 at 06:07:01AM +0200, Andreas Rogge wrote:
diff --git a/backend/server/apacheHandler.py
b/backend/server/apacheHandler.py
index 2d3530f..a1b4e04 100644
--- a/backend/server/apacheHandler.py
+++ b/backend/server/apacheHandler.py
@@ -193,6 +193,8 @@ class apacheHandler(apacheSession):
# Avoid leaving Oracle deadlocks
try:
ret = self._req_processor.process()
+ if not CFG.SEND_MESSAGE_TO_ALL:
+ rhnSQL.commit()
except:
if not CFG.SEND_MESSAGE_TO_ALL:
rhnSQL.rollback()
Andreas,
thanks for the patch. While I agree that we should not leave
active transactions behind when we are finished processing the
request, I am not sure the commit is the best way to go. Ideally it
should be the individual application which would make an informed
decision about committing its work. And if it decided not to commit
(or it did not commit due to a bug in the code), we should probably
just rollback.
Would rhnSQL.rollback() instead of rhnSQL.commit() sound reasonable?
I don't think so. I guess the best way to go is:
call the handler
if all went well, commit
if something failed, rollback
That's what the code above does. If anything goes really wrong the
handler should throw an exception and the transaction will be rolled back.
The right way to fix this would be to trace *all* handlers and see which
one leaves dangling transactions behind.
There is probably a reason that transactions are only rolled back when
an exception inside the handler occurs.
I think addition of a commit right here is the least intrusive way to
work around the issue (especially as there already is an
oracle-workaround one line below).
I have no idea wether there's a way to ask the PostgreSQL/Oracle session
wether there is uncommitted work and/or a transaction open.
If there is a way to check this, we could just log detailed
warning-messages when a handler returns and rhnSQL has an open transaction.
Regards,
Andreas
--
Solvention Ltd. & Co. KG
Egermannstr. 6-8
53359 Rheinbach
Tel: +49 2226 158179-0
Fax: +49 2226 158179-9
http://www.solvention.de
mailto:i...@solvention.de
_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel