Add fatal LoggingThread error backout strategy #253
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #169, fatal LoggingThread errors were logged to the worker's local log file before exiting.
In #248, a more drastic measure was taken: all exceptions were indefinitely retried and the ability to write exceptions to the worker's local log file was removed. This approach could prevent the LoggingThread from terminating when encountering a fatal error.
This commit combines the two approaches, backing out and exiting only after determining we've identified a persistent fatal error.
The means by which we identify a fatal (vs a temporary/non-fatal) LoggingThread error is by simply retrying the
upload_task_log
method during a defined interval (defined by the LoggingThread's_timeout
attribute).If the method continues to fail for the duration of the interval (i.e., does not succeed by the time the timeout is reached), we can consider the error to be fatal. At this point, we attempt to instead write the error to the worker's local log file, and raise the exception.
Note that the timeout can be toggled using the
KOBO_LOGGING_THREAD_TIMEOUT
environment variable.