Closed krisstern closed 2 years ago
Hi
sorry to jump in, but just to confirm, seeing below log means the exception is properly caught by your code:
[2022-08-29 09:15:55.030] [WARNING] [hudson.plugins.build_timeout.global.GlobalTimeOutConfiguration timeOutFor] job_with_timeout#98949 cannot allow individual jobs to overwrite timeout due to ClassCastException
java.lang.ClassCastException: class hudson.matrix.MatrixProject cannot be cast to class hudson.model.Project (hudson.matrix.MatrixProject is in unnamed module of loader jenkins.util.AntClassLoader @4722b12d; hudson.model.Project is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @36b4fe2a)
at hudson.plugins.build_timeout.global.GlobalTimeOutConfiguration.timeOutFor(GlobalTimeOutConfiguration.java:91)
at hudson.plugins.build_timeout.global.GlobalTimeOutRunListener.setUpEnvironment(GlobalTimeOutRunListener.java:43)
at hudson.model.AbstractBuild$AbstractBuildExecution.createLauncher(AbstractBuild.java:615)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:483)
at hudson.model.Run.execute(Run.java:1897)
at hudson.matrix.MatrixBuild.run(MatrixBuild.java:323)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
Thanks for your work
Hi @gjabouley-invn Yup, that is the warning due to the exception properly caught by the new code. It's my pleasure!
Ok thanks for the confirmation.
So far, as we are using a lot of Matrix Jobs, this warning and the exception stack is bloating our logs. This is strange that even for jobs not using the build timeout feature, the warning is raised...
Sure, sounds good
Is it normal that even for matrix jobs not using the build timeout feature, the warning is raised ?
Actually I don't think it is normal, or at least it is not expected
Fixes #97
Description
Use additional try/catch statements to handle the
ClassCastException
that arises for projects that do not actually belong to thehudson.model.Project
class. The bug was first introduced in PR #95, but was not caught by the tests.Checklist