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

hudson.scheduler.CronTabTest unit test failure.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Component/s: core
    • Labels:
      None
    • Environment:

      Description

      CronTabTest fails to complete and gets stuck in an infinite loop inside the code under test.

      The scheduler keeps bounding arround on the year change and never completes making runnning unit tests impossible (even if you ignore failures!)

      ...
      Running hudson.scheduler.CronTabTest
      01-Mar-2000 01:30:00 vs 01-Mar-2000 01:30:00
      01-Mar-2000 02:00:00 vs 01-Mar-2000 02:00:00
      01-Mar-2000 03:15:00 vs 01-Mar-2000 03:15:00
      01-Aug-2010 00:00:00 vs 01-Aug-2010 00:00:00
      01-Mar-2000 01:30:00 vs 01-Mar-2000 01:30:00
      01-Mar-2000 00:30:00 vs 01-Mar-2000 00:30:00
      01-Mar-2000 03:45:00 vs 01-Mar-2000 03:45:00
      (ctrl-c here)
      Destroying 1 processes
      Destroying process..
      Destroyed 1 processes
      Terminate batch job (Y/N)? y
      

      The test in question is testFloor3

      As scheduling is a major part of Hudson I'm not sure why this hasn't caused any issues in the field.

        Issue Links

          Activity

          Hide
          teilo James Nord added a comment -

          test appears to be passing on http://ci.hudson-labs.org/job/hudson_main_trunk/422/

          which leaves environment issues - but there doesn't seem to be anyhting in the way of an environment that would affect it.

          It fails on my two windows machines but works on the Linux CI.
          I have tested with different timezones and Locales.
          mvn test -Dtest=CronTabTest -Duser.timezone=US/Pacific -Duser.language=en -Duser.region=US

          The issue is that when it rounds down the DAY_OF_WEEK from 6 to 0 (2011-01-01 23:59:00.000)
          it is not clever enough to work out that this is going back in time to the previous Sunday and not the next sunday - which may normally surfice but this causes a loop as we don't round go to 2010-12-26 25:59:00.000 but 2011-01-02 23:59:00.000 and this causes a loop.

          There is no platform specic code that I can see that would explain the test passing elsewhere.
          appears to

          Show
          teilo James Nord added a comment - test appears to be passing on http://ci.hudson-labs.org/job/hudson_main_trunk/422/ which leaves environment issues - but there doesn't seem to be anyhting in the way of an environment that would affect it. It fails on my two windows machines but works on the Linux CI. I have tested with different timezones and Locales. mvn test -Dtest=CronTabTest -Duser.timezone=US/Pacific -Duser.language=en -Duser.region=US The issue is that when it rounds down the DAY_OF_WEEK from 6 to 0 (2011-01-01 23:59:00.000) it is not clever enough to work out that this is going back in time to the previous Sunday and not the next sunday - which may normally surfice but this causes a loop as we don't round go to 2010-12-26 25:59:00.000 but 2011-01-02 23:59:00.000 and this causes a loop. There is no platform specic code that I can see that would explain the test passing elsewhere. appears to
          Hide
          teilo James Nord added a comment -

          certainly seems to be windows related.
          Installed Ubuntu 10.10 x86 in a local VM and the test passes without issue.

          Show
          teilo James Nord added a comment - certainly seems to be windows related. Installed Ubuntu 10.10 x86 in a local VM and the test passes without issue.
          Hide
          teilo James Nord added a comment -

          This does appear very sinister, as it is locale dependant.

          If the Windows Regional Options are set to English (United States) the it passes.
          If it is set to English (United Kingdom) it spins forever.

          I wonder if the locale affects the day of week which exposes this.

          Show
          teilo James Nord added a comment - This does appear very sinister, as it is locale dependant. If the Windows Regional Options are set to English (United States) the it passes. If it is set to English (United Kingdom) it spins forever. I wonder if the locale affects the day of week which exposes this.
          Hide
          teilo James Nord added a comment -

          On linux the followinf will reproduce the issue (in core module)
          export LANG=en_GB.utf8
          mvn -Dtest=CronTabTest test

          Show
          teilo James Nord added a comment - On linux the followinf will reproduce the issue (in core module) export LANG=en_GB.utf8 mvn -Dtest=CronTabTest test
          Hide
          teilo James Nord added a comment -

          patch - fixes unit tests failure.
          tested with en_US, en_GB, fr_FR, FR_CA

          Show
          teilo James Nord added a comment - patch - fixes unit tests failure. tested with en_US, en_GB, fr_FR, FR_CA
          Show
          kohsuke Kohsuke Kawaguchi added a comment - Discussion of this is in http://groups.google.com/group/hudson-dev/browse_thread/thread/27d200b04738cdea#
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in hudson
          User: Kohsuke Kawaguchi
          Path:
          changelog.html
          core/src/main/java/hudson/scheduler/CronTab.java
          core/src/test/java/hudson/scheduler/CronTabTest.java
          http://hudson-labs.org/commit/core/841155732225d17b47a408d6e04c972af969b237
          Log:
          [FIXED JENKINS-8401] calendar handling fix with Mon-Sun week (as opposed to Sun-Sat week)

          Having a calendar with the first day of week being Monday (such as in the en_GB locale), setting DoW to Sunday moves the calendar forward whereas in cron it expects the calendar to go backward in time.

          Adjusting this logic.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: Kohsuke Kawaguchi Path: changelog.html core/src/main/java/hudson/scheduler/CronTab.java core/src/test/java/hudson/scheduler/CronTabTest.java http://hudson-labs.org/commit/core/841155732225d17b47a408d6e04c972af969b237 Log: [FIXED JENKINS-8401] calendar handling fix with Mon-Sun week (as opposed to Sun-Sat week) Having a calendar with the first day of week being Monday (such as in the en_GB locale), setting DoW to Sunday moves the calendar forward whereas in cron it expects the calendar to go backward in time. Adjusting this logic.
          Hide
          dogfood dogfood added a comment -

          Integrated in hudson_main_trunk #457
          [FIXED JENKINS-8401] calendar handling fix with Mon-Sun week (as opposed to Sun-Sat week)

          Kohsuke Kawaguchi :
          Files :

          • core/src/test/java/hudson/scheduler/CronTabTest.java
          • changelog.html
          • core/src/main/java/hudson/scheduler/CronTab.java
          Show
          dogfood dogfood added a comment - Integrated in hudson_main_trunk #457 [FIXED JENKINS-8401] calendar handling fix with Mon-Sun week (as opposed to Sun-Sat week) Kohsuke Kawaguchi : Files : core/src/test/java/hudson/scheduler/CronTabTest.java changelog.html core/src/main/java/hudson/scheduler/CronTab.java

            People

            • Assignee:
              Unassigned
              Reporter:
              teilo James Nord
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: