I have a cronjob that processes emails and saves them in the system. It has been working well for over a year, but now it has suddenly started to give out these strange transaction errors from time to time.
2010-09-02-01:45:11 ERROR Exception occured during mail processing
Traceback (most recent call last):
File "/var/www/example.com/project/scripts/cronjobs.py", line 453, in process_msg
source, email, 'i' if rejection_reason else 'v', rejection_reason)
File "/usr/lib/python2.5/site-packages/django/db/transaction.py", line 267, in _commit_manually
leave_transaction_management()
File "/usr/lib/python2.5/site-packages/django/db/transaction.py", line 77, in leave_transaction_management
raise TransactionManagementError("Transaction managed block ended with pending COMMIT/ROLLBACK")
TransactionManagementError: Transaction managed block ended with pending COMMIT/ROLLBACK
This happens for no reason, and there is no other context information available to me. Here is the structure of my process_msg function:
@commit_manually
def save_email( u,l, d, t, s, e, status, reason):
try:
commit()
exception, e:
rollback()
raise e
def process_msg(m):
try:
save_email(u, l, d, t
source, email, 'i' if rejection_reason else 'v', rejection_reason)
except Exception, e:
logger.error('Error while processing email', exc_info=True )
return None
else:
return True
How do I research this problem?
source
share