lau / tzdata

tzdata for Elixir. Born from the Calendar library.
MIT License
303 stars 71 forks source link

GenServer :tzdata_release_updater terminating #143

Closed tomciopp closed 1 month ago

tomciopp commented 2 months ago

Recently I've seen an error with the tzdata_release_updater

2024-09-05 20:32:05.376 [error] GenServer :tzdata_release_updater terminating
** (ArgumentError) errors were found at the given arguments:

  * 2nd argument: not a tuple

    :erlang.element(1, :error)
    (tzdata 1.1.1) lib/tzdata/util.ex:223: Tzdata.Util.to_int/1
    (tzdata 1.1.1) lib/tzdata/parser.ex:38: Tzdata.Parser.process_rule/1
    (tzdata 1.1.1) lib/tzdata/parser.ex:24: Tzdata.Parser.process_tz_list/1
    (tzdata 1.1.1) lib/tzdata/parser.ex:86: Tzdata.Parser.process_zone/5
    (tzdata 1.1.1) lib/tzdata/parser.ex:24: Tzdata.Parser.process_tz_list/1
    (tzdata 1.1.1) lib/tzdata/parser.ex:86: Tzdata.Parser.process_zone/5
    (tzdata 1.1.1) lib/tzdata/parser.ex:24: Tzdata.Parser.process_tz_list/1
    (tzdata 1.1.1) lib/tzdata/parser.ex:86: Tzdata.Parser.process_zone/5
    (tzdata 1.1.1) lib/tzdata/parser.ex:24: Tzdata.Parser.process_tz_list/1
    (tzdata 1.1.1) lib/tzdata/parser.ex:86: Tzdata.Parser.process_zone/5
    (tzdata 1.1.1) lib/tzdata/parser.ex:24: Tzdata.Parser.process_tz_list/1
    (tzdata 1.1.1) lib/tzdata/parser.ex:86: Tzdata.Parser.process_zone/5
    (tzdata 1.1.1) lib/tzdata/parser.ex:24: Tzdata.Parser.process_tz_list/1
    (tzdata 1.1.1) lib/tzdata/parser.ex:86: Tzdata.Parser.process_zone/5
    (tzdata 1.1.1) lib/tzdata/parser.ex:24: Tzdata.Parser.process_tz_list/1
    (tzdata 1.1.1) lib/tzdata/parser.ex:86: Tzdata.Parser.process_zone/5
    (tzdata 1.1.1) lib/tzdata/parser.ex:24: Tzdata.Parser.process_tz_list/1
    (tzdata 1.1.1) lib/tzdata/parser.ex:86: Tzdata.Parser.process_zone/5
    (tzdata 1.1.1) lib/tzdata/parser.ex:24: Tzdata.Parser.process_tz_list/1
Last message: :check_if_time_to_update
State: []

It looks like there was a recent release of the tzdb and there may need to be some code changes to accommodate them. https://lists.iana.org/hyperkitty/list/tz-announce@iana.org/thread/IZ7AO6WRE3W3TWBL5IR6PMQUL433BQIE/

mathieuprog commented 2 months ago

With version 2024b, an error was also introduced in tz library (an alternative) due to a change in the formatting of month names.

Month names have always been written in their abbreviated form (e.g., “Apr”). However, in version 2024b, there is an occurrence where a full month name (“April”) is used, which caused the issue.

Source: https://lists.iana.org/hyperkitty/list/tz@iana.org/thread/Y5KABB56LLOPHQJL4MFHWHSLR7KJ2XSP/

API2-studio commented 2 months ago

What is the proposed resolution for this ?

ruslandoga commented 2 months ago

Seems like 2024b has been rolled back:

$ curl -sL https://data.iana.org/time-zones/tzdata-latest.tar.gz | tar xzO version
2024a
DerTim1 commented 2 months ago

@ruslandoga Not for me:

$ date; curl -sL https://data.iana.org/time-zones/tzdata-latest.tar.gz | tar xzO version
Fr 6. Sep 09:22:46 CEST 2024
2024b
technicalcapt commented 2 months ago

Follow up https://github.com/lau/tzdata/issues/143#issuecomment-2333121077

For a temporary fix in deps/tzdata/lib/tzdata/util.ex:163

defp cap_month_number_for_month_name("april"), do: 4

I tested locally and the tz DB should be saved and loaded successfully for 2024b.

ruslandoga commented 2 months ago

There might be more changes required, some datetimes miss zone_abbr on 2024b: https://github.com/lau/tzdata/pull/144#issuecomment-2333451218

brandynbennett commented 2 months ago

One workaround I found is to set a config of config :tzdata, :autoupdate, :disabled, however that sets the timezone data file back to Oct 2021 unless you manually include it in the :data_dir

ragamuf commented 2 months ago

For now, you can follow the directions here to switch to the latest stable version in your cache. In my case, this is 2024a, which acts as my fallback on failure instead of using the embedded one from 2021.

https://github.com/lau/tzdata?tab=readme-ov-file#data-directory-and-releases