I tried running a job in Jenkins and got the following exception:
[EnvInject] - Loading node environment variables.
[EnvInject] - [ERROR] - SEVERE ERROR occurs: hudson.remoting.ChannelClosedException: channel is already closed
FATAL: null
java.lang.NullPointerException
at hudson.tasks.MailSender.createFailureMail(MailSender.java:279)
at hudson.tasks.MailSender.getMail(MailSender.java:154)
at hudson.tasks.MailSender.execute(MailSender.java:100)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.cleanUp(MavenModuleSetBuild.java:1025)
at hudson.model.Run.execute(Run.java:1648)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:506)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:247)
Hitting "build now" multiple times results in the same exception over and over again. I am expecting Jenkins to automatically reconnect with the node after this exception occurs but it does not.
It looks like EnvInject plugin runs into this exception and passes the failure on to Jenkins which then runs into a NPE. Ideally this bug should be solved so that regardless how the plugins behave, Jenkins will be smart enough to reconnect (i.e. faulty plugins shouldn't block a reconnect).
On a related note, if you read the above log you will notice that Jenkins doesn't say which node is disconnected which makes it very difficult to know which node needs to be reconnected. I ended up restarting nodes one by one until I got the right one. Very annoying
Please correct this bug as well.