Project

General

Profile

Actions

Bug #9141

open

[SDKs] Bad use of RetryLoop in events.py

Added by Brett Smith over 8 years ago. Updated 10 months ago.

Status:
New
Priority:
Normal
Assigned To:
-
Category:
-
Target version:
Story points:
-
Release:
Release relationship:
Auto

Description

This is a common idiom in events.py:

for tries_left in RetryLoop(...):
    ...
if tries_left == 0:
    _logger.exception("Everything is terrible")
    ...

There are two bugs in this pattern.

First, if the body of the RetryLoop succeeds on the last attempt, tries_left == 0 will be true, and it will be incorrectly treated as a failure.

Second, no exception is being handled at the time we call _logger.exception(). Testing suggests that in this case, it just writes "None" where it would normally write a traceback. That's not helping anybody, so we should call a different logging method.

Separately from that, there are two times when the body of the RetryLoop is:

                   try:
                        items = self.api.[some method].execute()
                        break
                    except errors.ApiError as error:
                        pass
                    else:
                        tries_left = 0
                        break

break immediately breaks the control flow, so the else: block will never run. Was that supposed to be except Exception: instead?

Actions #1

Updated by Brett Smith over 8 years ago

  • Description updated (diff)
Actions #2

Updated by Brett Smith over 8 years ago

  • Target version set to Arvados Future Sprints
Actions #3

Updated by Ward Vandewege over 3 years ago

  • Target version deleted (Arvados Future Sprints)
Actions #4

Updated by Peter Amstutz almost 2 years ago

  • Release set to 60
Actions #5

Updated by Peter Amstutz 10 months ago

  • Target version set to Future
Actions

Also available in: Atom PDF