Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treat fatal errors as actually fatal #12842

Merged
merged 1 commit into from
Feb 8, 2017

Conversation

bparees
Copy link
Contributor

@bparees bparees commented Feb 6, 2017

fixes #6388

@bparees bparees force-pushed the fatal_retries branch 2 times, most recently from acdc780 to 8664b9d Compare February 6, 2017 22:28
@bparees
Copy link
Contributor Author

bparees commented Feb 6, 2017

@jim-minter ptal. among other things, we were not recognizing fatal errors as being fatal because they were pointers and our check only looked for non-pointer types. Also am now treating Forbidden as a fatal error. (we get a fatal error when the namespace is being deleted and we try to instantiate into it).

@bparees
Copy link
Contributor Author

bparees commented Feb 6, 2017

[test]

@bparees
Copy link
Contributor Author

bparees commented Feb 6, 2017

[testextended][extended:core(builds)]

Copy link
Contributor

@jim-minter jim-minter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better not to go down the path of type checking against FooError and *FooError everywhere - better not to return &FooError in the first place. Otherwise looks good.

_, isFatal := err.(ConfigControllerFatalError)
return isFatal
switch err.(type) {
case ConfigControllerFatalError, *ConfigControllerFatalError:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is bad news - is it possible to fix the one place where we return &ConfigControllerFatalError (as opposed to ConfigControllerFatalError) instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered it, but nothing is going to stop someone else from going it in the future, so i'd want to check both regardless.

_, isFatal := err.(FatalError)
return isFatal
switch err.(type) {
case FatalError, *FatalError:
Copy link
Contributor

@jim-minter jim-minter Feb 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anywhere in the codebase that returns &FatalError?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not today, but again, who knows what someone does tomorrow.

_, isFatal := err.(GeneratorFatalError)
return isFatal
switch err.(type) {
case GeneratorFatalError, *GeneratorFatalError:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's only one &GeneratorFatalError too

@bparees
Copy link
Contributor Author

bparees commented Feb 7, 2017

@jim-minter I agree that in theory we can fix the code so it all works with non-pointer types, but I wanted to be defensive against what someone does in the future... do you see an issue w/ checking for both types, even if we aren't using both today?

@jim-minter
Copy link
Contributor

OK, I stand by my instinct but realise my reasoning is wrong :-)

I think the actual issue is that we're not using a pointer receiver on func (e ConfigControllerFatalError) Error() string when we should be. Ditto FatalError and GeneratorFatalError.

If these lines are re-written to func (e *ConfigControllerFatalError) Error() string (etc.), then only *ConfigControllerFatalError (etc.) can implement error, and it is no longer necessary to test for ConfigControllerFatalError (etc.). I think that's the route forward.

@bparees
Copy link
Contributor Author

bparees commented Feb 7, 2017

this is one of the reasons i loathe golang's "it's sometimes a pointer" approach to pointers.

@bparees
Copy link
Contributor Author

bparees commented Feb 7, 2017

@jim-minter updated, ptal

@jim-minter
Copy link
Contributor

@bparees lgtm

@openshift-bot
Copy link
Contributor

Evaluated for origin testextended up to 361b63f

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 361b63f

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/13665/) (Base Commit: c1b17a1)

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/testextended FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin_extended/1074/) (Base Commit: c1b17a1) (Extended Tests: core(builds))

@bparees
Copy link
Contributor Author

bparees commented Feb 7, 2017

[merge]

@openshift-bot
Copy link
Contributor

openshift-bot commented Feb 7, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/13665/) (Image: devenv-rhel7_5877)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 361b63f

@openshift-bot openshift-bot merged commit b08efa1 into openshift:master Feb 8, 2017
@bparees bparees deleted the fatal_retries branch February 13, 2017 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build controller keeps retrying builds after build configs are deleted
3 participants