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

Yet more fixes #96

Merged
merged 12 commits into from
May 2, 2018
Merged

Yet more fixes #96

merged 12 commits into from
May 2, 2018

Conversation

svanoort
Copy link
Member

@svanoort svanoort commented Apr 28, 2018

MMMMM-multifix for (among others)

  • JENKINS-50888 - solved by fixing lazy-load issues where the execution's onLoad method isn't called.
  • JENKINS-50199 - builds not showing as done and resuming
  • Runs not showing as completed and hanging around as zombies if the FlowNodes can't load and they fail (because the GraphListener wasn't attached to call finish, the build was never marked completed). Also accounts for some with the 'blocksRestart' and similar.
  • Lazy load changes removed protection against double onLoad calls, restoring that
  • Fix various issues around lazy load and ensure build's result is set so it gets marked complete.

@svanoort svanoort changed the title [WIP] More fixes Yet more fixes May 1, 2018
@svanoort svanoort requested review from jglick, abayer, kshultzCB and rsandell and removed request for jglick May 1, 2018 14:43
jglick
jglick previously approved these changes May 1, 2018
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

Some minor comments, but from my limited understanding I do not see anything broken here.

@@ -439,7 +442,25 @@ public void doTerm() {
return;
}
final Throwable x = new FlowInterruptedException(Result.ABORTED);
Futures.addCallback(execution.getCurrentExecutions(/* cf. JENKINS-26148 */true), new FutureCallback<List<StepExecution>>() {
FlowExecution exec = getExecution();
if (exec == null) { // Already dead, just make sure statuses reflect that.
Copy link
Member

Choose a reason for hiding this comment

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

Seems like this check belongs more in doKill, but OK.

Copy link
Member Author

Choose a reason for hiding this comment

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

nah, doKill need not check - it's GOING TO null it, guaranteed. 😄

} else { // Remove the logs to copy - execution too broken to fetch nodes
logsToCopy.remove(id);
modified = true;
continue;
Copy link
Member

Choose a reason for hiding this comment

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

I think you mean break here.

Actually I think you meant to pull the getExecution() call outside the logsToCopy loop, just like the original “broken somehow” code just skipped the rest of this method.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, doing an even better version of that.

super.onLoad();

if (completed == Boolean.TRUE && result == null) {
LOGGER.log(Level.FINE, "Completed build with no result set, defaulting to failure for"+this);
Copy link
Member

Choose a reason for hiding this comment

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

BTW

LOGGER.log(Level.FINE, "Completed build with no result set, defaulting to failure for {0}", this);

(NetBeans at least will offer a code hint for this.)

if (result == null) {
setResult(Result.FAILURE);
}
LOGGER.log(Level.WARNING, "Nulling out FlowExecution due to error in build "+this.getFullDisplayName(), x);
Copy link
Member

Choose a reason for hiding this comment

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

For log messages, prefer Run.fullName (or simply Run.toString ~ this) over Run.fullDisplayName.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch.

private final class FailOnLoadListener implements GraphListener {
@Override public void onNewHead(FlowNode node) {
if (node instanceof FlowEndNode) {
Thread finishThread = new Thread(new Runnable() {
Copy link
Member

Choose a reason for hiding this comment

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

Timer.get().schedule(() -> {
    synchronized (getLogCopyGuard()) {
        finish(((FlowEndNode) node).getResult(), execution != null ? execution.getCauseOfFailure() : null);
    }
}, 1, TimeUnit.SECONDS);

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point -- should have done it that way initially, brain fart there.

abayer
abayer previously approved these changes May 1, 2018
Futures.addCallback(execution.getCurrentExecutions(/* cf. JENKINS-26148 */true), new FutureCallback<List<StepExecution>>() {
FlowExecution exec = getExecution();
if (exec == null) { // Already dead, just make sure statuses reflect that.
synchronized (getLogCopyGuard()) {
Copy link
Member

Choose a reason for hiding this comment

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

Any possibility of some comments explaining the logic here?

Copy link
Member Author

Choose a reason for hiding this comment

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

@abayer done!

@svanoort svanoort dismissed stale reviews from jglick and abayer May 1, 2018 22:05

needs re-review for changes

@svanoort svanoort requested review from abayer and jglick May 1, 2018 22:05
Copy link
Member

@rsandell rsandell left a comment

Choose a reason for hiding this comment

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

🐝

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

With the same caveats.

@@ -721,7 +724,7 @@ private String key() {
super.onLoad();

if (completed == Boolean.TRUE && result == null) {
LOGGER.log(Level.FINE, "Completed build with no result set, defaulting to failure for"+this);
LOGGER.log(Level.FINE, "Completed build with no result set, defaulting to failure for "+this);
Copy link
Member

Choose a reason for hiding this comment

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

Better style FWIW:

LOGGER.log(Level.FINE, "Completed build with no result set, defaulting to failure for {0}", this);

@svanoort svanoort merged commit aad1756 into jenkinsci:master May 2, 2018
@svanoort svanoort deleted the more-fixes branch May 2, 2018 21:01
@itdependsnetworks
Copy link

itdependsnetworks commented May 2, 2018

@svanoort seem to be getting issues now:

	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1890)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
	at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:3000)
	at java.net.URLConnection.getHeaderFieldLong(URLConnection.java:629)
	at java.net.URLConnection.getContentLengthLong(URLConnection.java:501)
	at java.net.URLConnection.getContentLength(URLConnection.java:485)
	at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1126)
Caused: java.io.FileNotFoundException: http://archives.jenkins-ci.org/plugins/workflow-job/2.21/workflow-job.hpi
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1944)
	at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1939)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1938)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1508)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
	at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1139)
Caused: java.io.IOException: Failed to load http://updates.jenkins-ci.org/download/plugins/workflow-job/2.21/workflow-job.hpi to /var/lib/jenkins/plugins/workflow-job.jpi.tmp
	at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1146)
Caused: hudson.util.IOException2: Failed to download from http://updates.jenkins-ci.org/download/plugins/workflow-job/2.21/workflow-job.hpi (redirected to: http://archives.jenkins-ci.org/plugins/workflow-job/2.21/workflow-job.hpi)
	at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:1172)
	at hudson.model.UpdateCenter$DownloadJob._run(UpdateCenter.java:1677)
	at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1874)
	at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1651)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:112)
	at java.lang.Thread.run(Thread.java:748)

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.

5 participants