After upgrading Jenkins and Plugins recently, the Post Build task randomly aborts with an exception as shown bellow. What is causing it and how can it be fixed?
Software Version:
Jenkins ver. 2.103; Hudson Post build task v1.8
Error Message (printed to Jenkins console):
15:29:38 ERROR: Step ‘Post build task’ aborted due to exception:
15:29:38 java.nio.charset.MalformedInputException: Input length = 1
15:29:38 at java.nio.charset.CoderResult.throwException(CoderResult.java:281)
15:29:38 at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339)
15:29:38 at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
15:29:38 at java.io.InputStreamReader.read(InputStreamReader.java:184)
15:29:38 at java.io.BufferedReader.fill(BufferedReader.java:161)
15:29:38 at java.io.BufferedReader.read1(BufferedReader.java:212)
15:29:38 at java.io.BufferedReader.read(BufferedReader.java:286)
15:29:38 at hudson.Util.loadFile(Util.java:199)
15:29:38 at hudson.model.Run.getLog(Run.java:1953)
15:29:38 at hudson.plugins.postbuildtask.PostbuildTask.perform(PostbuildTask.java:99)
15:29:38 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
15:29:38 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
15:29:38 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps (AbstractBuild.java:690)
15:29:38 at hudson.model.Build$BuildExecution.post2(Build.java:186)
15:29:38 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
15:29:38 at hudson.model.Run.execute(Run.java:1752)
15:29:38 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
15:29:38 at hudson.model.ResourceController.execute(ResourceController.java:97)
15:29:38 at hudson.model.Executor.run(Executor.java:429)
I believe this is related to JENKINS-49112.
The problem is that Jenkins cannot handle the charset when reading the console output during runtime. The breaking changes are reverted and the problem will be resolved in 2.104.