Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-41864

Illegal dates for cron entry cause 100% cpu

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: core
    • Labels:
    • Environment:
      Jenkins 2.45
    • Similar Issues:

      Description

      Similar to JENKINS-25897

      In a freestyle project,
      enter a cron with an illegal date like 0 0 31 6 *
      When saving or moving focus out of the entry box it will create a thread at 100% cpu.
      A new thread will be created each time, after saving, that you try to configure this job.

      Tested on LTS 1.651.3 ?
      2.45

      Handling GET /job/xxxxxxxxxx/descriptorByName/hudson.triggers.TimerTrigger/checkSpec from 127.0.0.1 : RequestHandlerThread5
      java.util.GregorianCalendar.add(Unknown Source)
      hudson.scheduler.CronTab$CalendarField$3.rollUp(CronTab.java:270)
      hudson.scheduler.CronTab.floor(CronTab.java:396)
      hudson.scheduler.CronTabList.previous(CronTabList.java:134)
      hudson.triggers.TimerTrigger$DescriptorImpl.updateValidationsForNextRun(TimerTrigger.java:106)
      hudson.triggers.TimerTrigger$DescriptorImpl.doCheckSpec(TimerTrigger.java:91)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      java.lang.reflect.Method.invoke(Unknown Source)
      org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:320)
      org.kohsuke.stapler.Function.bindAndInvoke(Function.java:163)
      org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
      org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:124)
      org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
      org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
      org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233)
      org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
      org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
      org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233)
      org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
      org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
      org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
      org.kohsuke.stapler.Stapler.service(Stapler.java:238)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
      org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
      hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
      com.smartcodeltd.jenkinsci.plugin.assetbundler.filters.LessCSS.doFilter(LessCSS.java:47)
      hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
      net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:201)
      net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:178)
      net.bull.javamelody.PluginMonitoringFilter.doFilter(PluginMonitoringFilter.java:85)
      org.jvnet.hudson.plugins.monitoring.HudsonMonitoringFilter.doFilter(HudsonMonitoringFilter.java:102)
      hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
      hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:126)
      org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)
      org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
      hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
      hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
      hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
      org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
      org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
      org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
      org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
      org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553)
      org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
      org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
      org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
      org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
      org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
      org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      org.eclipse.jetty.server.Server.handle(Server.java:499)
      org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
      org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
      org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
      winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
      java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      java.lang.Thread.run(Unknown Source)

        Attachments

          Issue Links

            Activity

            Hide
            thomaste stefan thomasson added a comment -

            Having the next-executions plugin https://wiki.jenkins-ci.org/display/JENKINS/Next+Executions
            installed also spawns new threads at 100%

            Show
            thomaste stefan thomasson added a comment - Having the next-executions plugin https://wiki.jenkins-ci.org/display/JENKINS/Next+Executions installed also spawns new threads at 100%
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Daniel Beck
            Path:
            core/src/main/java/hudson/scheduler/CronTab.java
            core/src/main/java/hudson/scheduler/RareOrImpossibleDateException.java
            core/src/main/java/hudson/triggers/TimerTrigger.java
            core/src/main/resources/hudson/triggers/Messages.properties
            http://jenkins-ci.org/commit/jenkins/6e5225c06b45a3e196c8647dd30275234e57a54c
            Log:
            [FIX JENKINS-41864] Add warning for rare dates

            Previously, impossible dates caused 100% CPU while Jenkins was
            trying to find the previous/next occurrence of the date.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/hudson/scheduler/CronTab.java core/src/main/java/hudson/scheduler/RareOrImpossibleDateException.java core/src/main/java/hudson/triggers/TimerTrigger.java core/src/main/resources/hudson/triggers/Messages.properties http://jenkins-ci.org/commit/jenkins/6e5225c06b45a3e196c8647dd30275234e57a54c Log: [FIX JENKINS-41864] Add warning for rare dates Previously, impossible dates caused 100% CPU while Jenkins was trying to find the previous/next occurrence of the date.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Daniel Beck
            Path:
            content/_data/changelogs/weekly.yml
            http://jenkins-ci.org/commit/jenkins.io/18692cddfee94d8c45ce297385b880c7698e8ab1
            Log:
            2.48 didn't actually contain JENKINS-41864

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: content/_data/changelogs/weekly.yml http://jenkins-ci.org/commit/jenkins.io/18692cddfee94d8c45ce297385b880c7698e8ab1 Log: 2.48 didn't actually contain JENKINS-41864
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Daniel Beck
            Path:
            content/_data/changelogs/weekly.yml
            http://jenkins-ci.org/commit/jenkins.io/abe2ced520a7c9c84145adb0629a0c9161149b0c
            Log:
            Merge pull request #707 from daniel-beck/JENKINS-41864

            2.48 didn't actually contain JENKINS-41864

            Compare: https://github.com/jenkins-infra/jenkins.io/compare/a615db1e9211...abe2ced520a7

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: content/_data/changelogs/weekly.yml http://jenkins-ci.org/commit/jenkins.io/abe2ced520a7c9c84145adb0629a0c9161149b0c Log: Merge pull request #707 from daniel-beck/ JENKINS-41864 2.48 didn't actually contain JENKINS-41864 Compare: https://github.com/jenkins-infra/jenkins.io/compare/a615db1e9211...abe2ced520a7
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            Daniel Beck Do you consider the integrated change as a full fix?

            Show
            oleg_nenashev Oleg Nenashev added a comment - Daniel Beck Do you consider the integrated change as a full fix?
            Hide
            danielbeck Daniel Beck added a comment -

            Oleg Nenashev Yes, hence the commit message and me resolving this issue. Why, did I miss something?

            Show
            danielbeck Daniel Beck added a comment - Oleg Nenashev Yes, hence the commit message and me resolving this issue. Why, did I miss something?
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Daniel Beck
            Path:
            core/src/main/java/hudson/scheduler/CronTab.java
            core/src/main/java/hudson/scheduler/RareOrImpossibleDateException.java
            core/src/main/java/hudson/triggers/TimerTrigger.java
            core/src/main/resources/hudson/triggers/Messages.properties
            http://jenkins-ci.org/commit/jenkins/933a4785afa03354055c6d12a8bb1ce3b8e43b0a
            Log:
            [FIX JENKINS-41864] Add warning for rare dates

            Previously, impossible dates caused 100% CPU while Jenkins was
            trying to find the previous/next occurrence of the date.

            (cherry picked from commit 6e5225c06b45a3e196c8647dd30275234e57a54c)

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/hudson/scheduler/CronTab.java core/src/main/java/hudson/scheduler/RareOrImpossibleDateException.java core/src/main/java/hudson/triggers/TimerTrigger.java core/src/main/resources/hudson/triggers/Messages.properties http://jenkins-ci.org/commit/jenkins/933a4785afa03354055c6d12a8bb1ce3b8e43b0a Log: [FIX JENKINS-41864] Add warning for rare dates Previously, impossible dates caused 100% CPU while Jenkins was trying to find the previous/next occurrence of the date. (cherry picked from commit 6e5225c06b45a3e196c8647dd30275234e57a54c)

              People

              • Assignee:
                danielbeck Daniel Beck
                Reporter:
                thomaste stefan thomasson
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: