mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 05:22:22 +00:00
[HUDSON-3081] Improved the error diagnostics.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@19759 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
3db6cce360
commit
18548cc86b
3 files changed
+35
-11
No files matched your search
@@ -29,10 +29,8 @@ import hudson.Launcher;
|
||||
import hudson.Util;
|
||||
import hudson.EnvVars;
|
||||
import hudson.FilePath.FileCallable;
|
||||
import hudson.matrix.MatrixConfiguration;
|
||||
import hudson.maven.MavenBuild.ProxyImpl2;
|
||||
import hudson.maven.reporters.MavenFingerprinter;
|
||||
import hudson.model.AbstractBuild;
|
||||
import hudson.model.AbstractProject;
|
||||
import hudson.model.Action;
|
||||
import hudson.model.Build;
|
||||
@@ -47,6 +45,7 @@ import hudson.model.TaskListener;
|
||||
import hudson.model.Cause.UpstreamCause;
|
||||
import hudson.remoting.Channel;
|
||||
import hudson.remoting.VirtualChannel;
|
||||
import hudson.remoting.RequestAbortedException;
|
||||
import hudson.tasks.BuildWrapper;
|
||||
import hudson.tasks.Maven.MavenInstallation;
|
||||
import hudson.util.ArgumentListBuilder;
|
||||
@@ -390,6 +389,17 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
|
||||
mpa = new MavenProbeAction(project,process.channel);
|
||||
addAction(mpa);
|
||||
return process.channel.call(builder);
|
||||
} catch (RequestAbortedException e) {
|
||||
// this is normally triggered by the unexpected Maven JVM termination.
|
||||
// check if the process is still alive, after giving it a bit of time to die
|
||||
Thread.sleep(1000);
|
||||
if(process.proc.isAlive())
|
||||
throw e; // it's still alive. treat this as a bug in the code
|
||||
else {
|
||||
String msg = "Maven JVM terminated unexpectedly with exit code " + process.proc.join();
|
||||
LOGGER.log(Level.FINE,msg,e);
|
||||
throw new AbortException(msg);
|
||||
}
|
||||
} finally {
|
||||
builder.end(launcher);
|
||||
getActions().remove(mpa);
|
||||
|
||||
@@ -33,6 +33,7 @@ import static hudson.Util.fixNull;
|
||||
import hudson.maven.agent.Main;
|
||||
import hudson.maven.agent.Maven21Interceptor;
|
||||
import hudson.maven.agent.PluginManagerInterceptor;
|
||||
import hudson.maven.ProcessCache.NewProcess;
|
||||
import hudson.model.BuildListener;
|
||||
import hudson.model.Computer;
|
||||
import hudson.model.Executor;
|
||||
@@ -186,7 +187,7 @@ final class MavenProcessFactory implements ProcessCache.Factory {
|
||||
/**
|
||||
* Starts maven process.
|
||||
*/
|
||||
public Channel newProcess(BuildListener listener, OutputStream out) throws IOException, InterruptedException {
|
||||
public NewProcess newProcess(BuildListener listener, OutputStream out) throws IOException, InterruptedException {
|
||||
if(debug)
|
||||
listener.getLogger().println("Using env variables: "+ envVars);
|
||||
try {
|
||||
@@ -208,11 +209,11 @@ final class MavenProcessFactory implements ProcessCache.Factory {
|
||||
throw e;
|
||||
}
|
||||
|
||||
return Channels.forProcess("Channel to Maven "+ Arrays.toString(cmds),
|
||||
Computer.threadPoolForRemoting, new BufferedInputStream(con.in), new BufferedOutputStream(con.out), listener.getLogger(), proc);
|
||||
|
||||
// return launcher.launchChannel(buildMavenCmdLine(listener).toCommandArray(),
|
||||
// out, workDir, envVars);
|
||||
return new NewProcess(
|
||||
Channels.forProcess("Channel to Maven "+ Arrays.toString(cmds),
|
||||
Computer.threadPoolForRemoting, new BufferedInputStream(con.in), new BufferedOutputStream(con.out),
|
||||
listener.getLogger(), proc),
|
||||
proc);
|
||||
} catch (IOException e) {
|
||||
if(fixNull(e.getMessage()).contains("java: not found")) {
|
||||
// diagnose issue #659
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
package hudson.maven;
|
||||
|
||||
import hudson.Util;
|
||||
import hudson.Proc;
|
||||
import hudson.model.BuildListener;
|
||||
import hudson.model.JDK;
|
||||
import hudson.model.TaskListener;
|
||||
@@ -60,12 +61,22 @@ public final class ProcessCache {
|
||||
* @param out
|
||||
* The output from the process should be sent to this output stream.
|
||||
*/
|
||||
Channel newProcess(BuildListener listener,OutputStream out) throws IOException, InterruptedException;
|
||||
NewProcess newProcess(BuildListener listener,OutputStream out) throws IOException, InterruptedException;
|
||||
String getMavenOpts();
|
||||
MavenInstallation getMavenInstallation(TaskListener listener) throws IOException, InterruptedException;
|
||||
JDK getJava(TaskListener listener) throws IOException, InterruptedException;
|
||||
}
|
||||
|
||||
public static class NewProcess {
|
||||
public final Channel channel;
|
||||
public final Proc proc;
|
||||
|
||||
public NewProcess(Channel channel, Proc proc) {
|
||||
this.channel = channel;
|
||||
this.proc = proc;
|
||||
}
|
||||
}
|
||||
|
||||
class MavenProcess {
|
||||
/**
|
||||
* Channel connected to the maven process.
|
||||
@@ -76,6 +87,7 @@ public final class ProcessCache {
|
||||
*/
|
||||
private final String mavenOpts;
|
||||
private final PerChannel parent;
|
||||
final Proc proc;
|
||||
private final MavenInstallation installation;
|
||||
private final JDK jdk;
|
||||
private final RedirectableOutputStream output;
|
||||
@@ -88,10 +100,11 @@ public final class ProcessCache {
|
||||
|
||||
private int age = 0;
|
||||
|
||||
MavenProcess(PerChannel parent, String mavenOpts, MavenInstallation installation, JDK jdk, Channel channel, RedirectableOutputStream output) throws IOException, InterruptedException {
|
||||
MavenProcess(PerChannel parent, String mavenOpts, MavenInstallation installation, JDK jdk, NewProcess np, RedirectableOutputStream output) throws IOException, InterruptedException {
|
||||
this.parent = parent;
|
||||
this.mavenOpts = mavenOpts;
|
||||
this.channel = channel;
|
||||
this.channel = np.channel;
|
||||
this.proc = np.proc;
|
||||
this.installation = installation;
|
||||
this.jdk = jdk;
|
||||
this.output = output;
|
||||
|
||||
Reference in new issue
Block a user