I added two lines of code:
print "run_with_transaction retval = func() failed"
traceback.print_stack()
to the part of run_with_transaction:
except:
rollback_all()
raise
And I can no longer reproduce the error. :{

