timja / jenkins-gh-issues-poc-06-18

0 stars 0 forks source link

[JENKINS-34172] Use of file parameter crashes Jenkins jobs sometimes #3026

Open timja opened 8 years ago

timja commented 8 years ago

In all of our Jenkins jobs we have a file parameter that can be passed in. The file is always called "buildspec.txt" and contains information useful for our build tool. This file parameter is optional.

99% of time this works perfectly but sometimes when triggering a build, Jenkins crashes when trying to copy the file. This is when the file has not been passed in. If I try doing the build again after the crash (again, without passing in any file) then it works. I get the following output on the build console:

Copying file to buildspec.txt
FATAL: java.lang.NullPointerException
java.io.IOException: java.lang.NullPointerException
at hudson.FilePath.copyFrom(FilePath.java:900)
at hudson.model.FileParameterValue$2.setUp(FileParameterValue.java:147)
at hudson.model.Build$BuildExecution.doRun(Build.java:154)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
at hudson.model.Run.execute(Run.java:1745)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Caused by: java.lang.NullPointerException
at hudson.FilePath.copyFrom(FilePath.java:896)
... 7 more

We are using Jenkins 1.580.3. I have Googled and also searched your Jira but cannot find anyone else having this exact error.


Originally reported by colinjenkins16, imported from: Use of file parameter crashes Jenkins jobs sometimes
  • status: Open
  • priority: Major
  • resolution: Unresolved
  • imported: 2022/01/10
timja commented 8 years ago

oleg_nenashev:

From what I see null FileItem gets to the list.
Most likely it's caused by the missing File item in the form submission (or by empty stream in it).

Jenkins core should at least verify such cases.