Reputation: 668
i would ask you to check something, because I am not sure if it a Jenkins bug or if it has to do something with our internal settings. Please tell me if you are faceing also exceptions when using upper-cases within the job name.
Bug description:
When I press the button "create", the tomcat cpu usage explode directly to 99% on the Jenkins server, the configuration page for the new created job is never displayed and stop the browser from loading has no effect to the CPU usage.
After recognizing that i wanted to check some more details and went to the monitoring page. I use the Monitoring plugin for Jenkins. And what i found was a thread within the "Current requests" that was running all the time... named "checkJobName". I killed it manually and the server went back to normal.
Reason:
Reading "checkJobName" made me think of something which leads me to the solution: When I want to create a new job everything is fine as long as the job key only contains lower-cases. When I fill in upper-cases I always ran into the bug described above.
Solution:
Before facing this bug my company used a regular expression to restriced job names. Under Jenkins -> Manage Jenkins -> Configure System -> Restrict project naming we had the following RegExp:
\bcom.mycompany.\b[a-z0-9]+(([\-]?[a-z0-9]+)+|([\.]?[a-z0-9]+)+)*+$
But it seems like this was not checking the whole word, because still uppercases were allowed when using names like "com.mycompany.test.myUpperCaseTest". To avoid the bug above i changed the RegExp so that only lower-cases are allowed:
\bcom.mycompany.\b[a-z0-9]+(([\-]?[a-z0-9]+)*|([\.]?[a-z0-9]+)*)*$
Upvotes: 1
Views: 690
Reputation: 138137
You are experiencing a catastrophic backtracking, maynly because of the nested loops and optional [\-]?
and [\.]?
. This is usually painful when the pattern does not match, as you've experienced.
Use this pattern instead:
^com\.mycompany\.[a-z0-9]+(?:[.\-][a-z0-9]+)*$
com!mycompany?job
[a-z0-9]+
- one word.(?:[.\-][a-z0-9]+)*
- zero or more words. Before each word there is a period or a hyphen.Upvotes: 1