Cron Trigger issues

114 views
Skip to first unread message

Kanstantsin Shautsou

unread,
Mar 23, 2015, 11:11:24 AM3/23/15
to jenkin...@googlegroups.com
I got weird situation when Trigger is executed for disabled project. I'm checking sources 

 https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/triggers/Trigger.java#L256-L276 and don't see any checks for disabled project at all (1). 

I also had a case when .run() was called before .start() on Trigger (2) .

Does anyone know is it designed or bug (1) (2)?

Jesse Glick

unread,
Mar 23, 2015, 12:57:12 PM3/23/15
to Jenkins Dev
On Mon, Mar 23, 2015 at 11:11 AM, Kanstantsin Shautsou
<kanstan...@gmail.com> wrote:
> I got weird situation when Trigger is executed for disabled project.

Possible that each Trigger is expected to suppress itself at some
point for a disabled project, or possible that this is a mistake. Does
this happen for standard TimerTrigger and SCMTrigger? Is the behavior
the same in old Jenkins releases?

> I also had a case when .run() was called before .start() on Trigger

Seems like a bug (race condition).

Kanstantsin Shautsou

unread,
Mar 23, 2015, 1:19:14 PM3/23/15
to jenkin...@googlegroups.com
Suppressing Triggers itself is not performance friendly. You may have hundred jobs with "* * * * *" but only one enabled.
I see no changes in triggers package since previous year, so i mostly test on 1.565.3
Search in jira found only thousands issues for triggering jobs. 

Created job timerTrigger with cron "* * * * *" and disabled.
Logger for hudson.triggers shows:
Mar 23, 2015 8:16:00 PM FINE hudson.triggers.Trigger
cron checking hudson.model.FreeStyleProject@6878439f[timerTrigger] with spec ‘* * * * *’
Mar 23, 2015 8:16:00 PM CONFIG hudson.triggers.Trigger
cron triggered hudson.model.FreeStyleProject@6878439f[timerTrigger]
According to code it calls job.scheduleBuild(0, new TimerTriggerCause()) and then probably suppressed in queue...

Kanstantsin Shautsou

unread,
Mar 23, 2015, 1:27:37 PM3/23/15
to jenkin...@googlegroups.com

Kanstantsin Shautsou

unread,
Mar 23, 2015, 1:56:19 PM3/23/15
to jenkin...@googlegroups.com
For SCMTrigger it more deep
Mar 23, 2015 8:47:08 PM FINE hudson.triggers.Trigger
cron checking hudson.model.FreeStyleProject@39d5e0de[scmTrigger] with spec ‘* * * * *’
Mar 23, 2015 8:47:08 PM CONFIG hudson.triggers.Trigger
cron triggered hudson.model.FreeStyleProject@39d5e0de[scmTrigger]
Mar 23, 2015 8:47:09 PM FINE hudson.triggers.SCMTrigger
Scheduling a polling for hudson.model.FreeStyleProject@39d5e0de[scmTrigger]
Mar 23, 2015 8:47:09 PM FINE hudson.triggers.SCMTrigger
scheduling the trigger to (asynchronously) run
Then it goes to SCMTrigger.Descriptor queue
https://github.com/jenkinsci/jenkins/blob/608517e187cb5bd1566b1c3728a4df0f7ac4dd5c/core/src/main/java/hudson/triggers/SCMTrigger.java#L148
Then queue execute item run()
https://github.com/jenkinsci/jenkins/blob/608517e187cb5bd1566b1c3728a4df0f7ac4dd5c/core/src/main/java/hudson/triggers/SCMTrigger.java#L544
then do runPolling check
https://github.com/jenkinsci/jenkins/blob/608517e187cb5bd1566b1c3728a4df0f7ac4dd5c/core/src/main/java/hudson/triggers/SCMTrigger.java#L505-L515
then finally it checks that item is not Buildable
https://github.com/jenkinsci/jenkins/blob/12251abe8fc46958a1ee931e9bd1ec6730f1efb0/core/src/main/java/hudson/model/AbstractProject.java#L1315-L1323

Kanstantsin Shautsou

unread,
Mar 23, 2015, 4:21:55 PM3/23/15
to jenkin...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages