Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erlang 26, Elixir 1.15.4 mix tz_world.update not working #33

Closed
mjquinlan2000 opened this issue Aug 16, 2023 · 7 comments · Fixed by #34
Closed

Erlang 26, Elixir 1.15.4 mix tz_world.update not working #33

mjquinlan2000 opened this issue Aug 16, 2023 · 7 comments · Fixed by #34

Comments

@mjquinlan2000
Copy link

Hello,

I am trying to update my application to elixir 1.15.4 and erlang 26.0.2 and I am getting the following error when trying to run mix tz_world.update

** (UndefinedFunctionError) function :public_key.pkix_verify_hostname_match_fun/1 is undefined (module :public_key is not available)
    (public_key 1.14) :public_key.pkix_verify_hostname_match_fun(:https)
    (tz_world 1.3.0) lib/tz_world/downloader.ex:243: TzWorld.Downloader.https_opts/0
    (tz_world 1.3.0) lib/tz_world/downloader.ex:131: TzWorld.Downloader.get_url/1
    (tz_world 1.3.0) lib/tz_world/downloader.ex:114: TzWorld.Downloader.get_releases/0
    (tz_world 1.3.0) lib/tz_world/downloader.ex:21: TzWorld.Downloader.latest_release/1
    (tz_world 1.3.0) lib/mix/tasks/update_timezones_geojson.ex:59: Mix.Tasks.TzWorld.Update.update/2
    (mix 1.15.4) lib/mix/task.ex:447: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.15.4) lib/mix/cli.ex:92: Mix.CLI.run_task/2

Here is my elixir --version info:

Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]

Elixir 1.15.4 (compiled with Erlang/OTP 26)

I suspect it has to do with elixir's new code path pruning features, but I can't seem to track down why :public_key would not be available as it is listed in the mix.exs extra_applications as a dependency.

Any help on this would be greatly appreciated.

Thank you

@mjquinlan2000
Copy link
Author

Furthermore, I have an aliased mix task for my ci environment:

"ci.migrate": ["ecto.create", "tz_world.update", "ecto.migrate"]

(there is an ecto dependency)

When I run that, the tz_world.update task runs successfully.

@kipcole9
Copy link
Collaborator

@mjquinlan2000 thanks for the report and sorry for the inconvenience. I've just tried mix tz_world.update on Elixir 1.15.4 and OTP 26.0.2 and I'm also getting an error - but a completely different one (a runtime error). I definitely need to dig into this.

It's super late (or very early?) here so I hope you won't mind if I tackle this in a few hours?.

@kipcole9
Copy link
Collaborator

I've published tz_world version 1.3.1 with the following changelog entry. Please do let me know if you see additional issues.

Bug Fixes.

Thanks to @mjquinlan2000 for the report of issues on Elixir 1.15 and OTP 26.

  • Always send a User-Agent header to the Github API to avoid 403 responses.

  • Add :ssl to :extra_applications to support Elixir 1.15 and OTP 26.

  • Update TzWorld.Downloader.get_url/1 to follow the erlef security guidelines.

@mjquinlan2000
Copy link
Author

Thank you @kipcole9 for the speedy update. You rock! I am running through the tests now and it looks like the issue is resolved.

@kipcole9
Copy link
Collaborator

Happy to hear it's ok in your end. Thanks for raising the issue. And so let me know if you have any feature requests - that's how I nice this library forward.

tcitworld added a commit to framasoft/mobilizon that referenced this issue Aug 18, 2023
…not available

Reference kimlai/tz_world#33

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
@tcitworld
Copy link
Contributor

I'm getting the following output for some reason from time to time with 1.3.1. It doesn't happen after rollbacking on 1.3.0. I've yet to investigate if it's some kind of race condition and how this can happen.

** (UndefinedFunctionError) function :ssl_cipher.crypto_support_filters/0 is undefined (module :ssl_cipher is not available)
    (ssl 11.0.2) :ssl_cipher.crypto_support_filters()
    (ssl 11.0.2) ssl.erl:1067: :ssl.filter_cipher_suites/2
    (tz_world 1.3.1) lib/tz_world/downloader.ex:559: TzWorld.Downloader.https_ssl_opts/2
    (tz_world 1.3.1) lib/tz_world/downloader.ex:541: TzWorld.Downloader.http_opts/2
    (tz_world 1.3.1) lib/tz_world/downloader.ex:384: TzWorld.Downloader.get_with_headers/2
    (tz_world 1.3.1) lib/tz_world/downloader.ex:245: TzWorld.Downloader.get/2
    (tz_world 1.3.1) lib/tz_world/downloader.ex:118: TzWorld.Downloader.get_releases/0
    (tz_world 1.3.1) lib/tz_world/downloader.ex:25: TzWorld.Downloader.latest_release/1

@kipcole9
Copy link
Collaborator

kipcole9 commented Aug 19, 2023

That's very frustrating! Intermittent errors are the worst. Sorry for the slow response, was stuck in flight hell for a long time.

Nothing in my code calls a function in the :ssl_cipher module, its indirectly called by :ssl.filter_cipher_suites(preferred_ciphers, []) (which is not in tz_world 1.3.0 - I improved the security of the downloader in 1.3.1 which is why you don't see this on that version).

I use this same code in ex_cldr and this issue has never been raised there so it's even more curious.

The first thing the mix task does is to start all the required applications. I've now added some additional checks:

 defp start_applications do
    {:ok, _} = Application.ensure_all_started(:tz_world)
    {:ok, _} = Application.ensure_all_started(:inets)
    {:ok, _} = Application.ensure_all_started(:ssl)
    {:module, _} = Code.ensure_loaded(:ssl_cipher)

    TzWorld.Backend.Memory.start_link
    TzWorld.Backend.Dets.start_link
  end

So if there is an issue with the availability of :ssl_cipher it will be detected right up front. If you're able to test using the version from GitHub using {:tz_world, github: "kipcole9/tz_world"} that might either fix the issue, or at least help pinpoint better what is going on.

tcitworld added a commit to framasoft/mobilizon that referenced this issue Sep 1, 2023
…pdate

Reference kimlai/tz_world#33

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants