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

[JENKINS-60354] Add flag to FlowInterruptedException to indicate non-interruptions #51

Merged
merged 2 commits into from
Jan 3, 2020

Conversation

dwnusbaum
Copy link
Member

@dwnusbaum dwnusbaum commented Dec 5, 2019

See JENKINS-60354.

Downstream PRs:

Problem

This PR and the linked tickets are trying to solve a problem introduced by jenkinsci/pipeline-build-step-plugin#24 that caused failures of the build step to be treated like build interruptions by the retry step, so the build failure was ignored instead of being retried. This happened because the build step started using FlowInterruptedException so that it could propagate the exact result of the downstream job instead of always propagating FAILURE. FlowInterruptedException is used for things like manual build interruptions, and so some steps that catch exceptions, such as retry, have special behavior to rethrow this kind of exception.

Fix

This chain of PRs tries to fix the issue by adding a flag to FlowInterruptedException that can be set to false to indicate that the exception should not be considered a build interruption, and that this type is only being used to track a specific build result. With this approach, we only need to change build to start setting this flag, and then steps like retry to examine this flag when choosing whether to handle or rethrow FlowInterruptedException.

Potential Alternative Fix

I'm not super happy about reusing FlowInterruptedException for both interruptions and non-interruptions in this way. An alternative fix could be to introduce a new HasResult interface with a getResult method, maybe along with a ShowStackTrace marker interface, have FlowInterruptedException implement those interfaces. Then we'd update code that currently only uses FlowInterruptedException for its result to use the HasResult interface, and update things that use concrete types to decide whether to show stack traces check for the ShowStackTrace instead. We'd also introduce a new PipelineResultException that implements those interfaces, and then have build throw that exception instead of FlowInterruptedException. That would quite a bit more work though, and would be more complex, requiring changes in workflow-job and workflow-cps in areas involving build completion, so I'm inclined to stick with the simple approach for now.

@dwnusbaum
Copy link
Member Author

Closing/reopening in the hopes that ci.jenkins.io will see the PR.

@dwnusbaum dwnusbaum closed this Dec 5, 2019
@dwnusbaum dwnusbaum reopened this Dec 5, 2019
@dwnusbaum
Copy link
Member Author

Weird, it looks like everything succeeded, and the incremental build was published, but then the agent got killed before the build completed?

Cannot contact aci-maven-t12f8: hudson.remoting.ChannelClosedException: Channel "unknown": Remote call on JNLP4-connect connection from 52.232.184.109/52.232.184.109:15297 failed. The channel is closing down or has closed down
19:41:27  Agent aci-maven-t12f8 was deleted; cancelling node body

@dwnusbaum
Copy link
Member Author

Rebuilding to try to get an incremental build published. The last build got a 500 internal server error, and I don't see any useful messages in the log.

@dwnusbaum dwnusbaum closed this Dec 9, 2019
@dwnusbaum dwnusbaum reopened this Dec 9, 2019
@dwnusbaum
Copy link
Member Author

The incrementals publisher is hosed, see INFRA-2379, so I deployed a snapshot manually as 2.22-20191211.162318-1.

@dwnusbaum dwnusbaum changed the title [JENKINS-60354] Add flag to FlowInterruptedException to indicate actual interruptions [JENKINS-60354] Add flag to FlowInterruptedException to indicate non-interruptions Dec 11, 2019
@dwnusbaum dwnusbaum marked this pull request as ready for review December 11, 2019 18:51
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.

3 participants