Skip to content

Task retry includes an extra -00:28 offset #4145

Closed

Description

@steve-gregory

Checklist

  • I have verified that the issue exists against the master branch of Celery.

Steps to reproduce

  1. Using celery master, call a task that will be 'retried'.
  2. Observe the eta in celery -A app inspect scheduled
  3. Set CELERY_ENABLE_UTC to True and CELERY_TIMEZONE to America/Phoenix

Expected behavior

-> <My Node Name>: OK
    * {'priority': 6, 'eta': '2017-07-19T17:02:33.164276-07:00', 'request': {'args': ...

<Task retries @ ETA time>

Actual behavior

-> <My Node Name>: OK
    * {'priority': 6, 'eta': '2017-07-19T17:02:33.164276-07:28', 'request': {'args': ...

<Task never retries. Retry count stays at one and the task hangs around indefinitely.>

Activity

  1. steve-gregory commented on Jul 19, 2017

    @steve-gregory
    Author

    Notes:

    • Tried other timezones (America/Los_Angeles) and got a similarly "weird" offset (-07:53).
    • This error does NOT happen if timezone is set to Etc/UTC
  2. georgepsarakis commented on Jul 19, 2017

    @georgepsarakis
    Contributor

    Have you perhaps noticed if it is only a representation issue or the ETA is actually incorrect?

  3. steve-gregory commented on Jul 19, 2017

    @steve-gregory
    Author

    @georgepsarakis (Just updated my description to reflect this) The ETA is actually incorrect and prevents the task from being executed.

  4. georgepsarakis commented on Jul 19, 2017

    @georgepsarakis
    Contributor

    There was a fix recently for ETA in #3753 , but perhaps this is unrelated.

  5. georgepsarakis commented on Jul 19, 2017

    @georgepsarakis
    Contributor

    Can you try with CELERY_ENABLE_UTC=False? In the issue that I mentioned, the correct way to respect the timezone setting was to also disable UTC.

  6. steve-gregory commented on Jul 19, 2017

    @steve-gregory
    Author

    @georgepsarakis disabling UTC did not solve my problem. After looking into the fix you mentioned above, i dropped in an rdb line to see what was happening.. Here are my results:

    > /opt/env/atmo_zz2/src/celery/celery/app/amqp.py(326)as_task_v2()
    -> eta = maybe_make_aware(
    (Pdb) n
    > /opt/env/atmo_zz2/src/celery/celery/app/amqp.py(327)as_task_v2()
    -> now + timedelta(seconds=countdown), tz=timezone,
    (Pdb)
    > /opt/env/atmo_zz2/src/celery/celery/app/amqp.py(329)as_task_v2()
    -> if isinstance(expires, numbers.Real):
    (Pdb) eta
    datetime.datetime(2017, 7, 19, 19, 38, 31, 324450, tzinfo=<DstTzInfo 'America/Phoenix' LMT-1 day, 16:32:00 STD>)
    (Pdb) timezone
    <DstTzInfo 'America/Phoenix' LMT-1 day, 16:32:00 STD> # NOTE: This is wrong!
    (Pdb) print timezone
    America/Phoenix
    (Pdb) type(timezone)
    <class 'pytz.tzfile.America/Phoenix'>
    (Pdb) n
    > /opt/env/atmo_zz2/src/celery/celery/app/amqp.py(336)as_task_v2()
    -> eta = eta and eta.isoformat()
    (Pdb) n
    > /opt/env/atmo_zz2/src/celery/celery/app/amqp.py(338)as_task_v2()
    -> if not isinstance(expires, string_t):
    (Pdb) p eta
    '2017-07-19T...-07:28'
    (Pdb) p countdown
    64
    
  7. added a commit that references this issue on Jul 20, 2017
  8. thedrow commented on Jul 29, 2017

    @thedrow
    Contributor

    Can you please verify that this is fixed with master?

  9. steve-gregory commented on Aug 4, 2017

    @steve-gregory
    Author

    Confirmed, fixed on master.

  10. jarshwah commented on Nov 28, 2017

    @jarshwah

    Is there a release planned any time soon with this fix? I'm looking at rolling back to 4.0 to avoid this problem.

    Using UTC fixes the eta problems, but the beat schedule is way off in return.

  11. thedrow commented on Nov 28, 2017

    @thedrow
    Contributor

    Yes, soon. But we want to merge a few things first.

  12. jarshwah commented on Nov 28, 2017

    @jarshwah

    No worries, thanks for the heads up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions