-
Notifications
You must be signed in to change notification settings - Fork 13
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
tz_world.update
taking over double the memory on OTP 27.0.1
#38
Comments
tz_world.update
taking over double the memory on Elixir 1.17tz_world.update
taking over double the memory on OTP 27.0.1
That's definitely unexpected. And there haven't been any commits that should affect the mix task. I see you changed the issue description to reflect an OTP 27 difference, rather than an Elixir 1.17 difference. Does that mean you see the memory difference with the same Elixir version but different OTP version? I will certainly take a look at this, but if might take a couple of days to try and diagnose. |
And I'll experiment with using the |
I can confirm that the memory difference is caused by the difference in OTP versisons for me. Building with OTP 25-26, and elixir 15-17 sees the same memory usage during |
Thanks much for the diagnostic. There are some things I can try to do to reduce memory usage and I'll experiment on the weekend. The key function that is most likely the memory consumer is: def transform_source_data(source_data, version) when is_binary(source_data) do
case :zip.unzip(source_data, [:memory]) do
{:ok, [{_, json} | _rest]} ->
json
|> Jason.decode!()
|> Geo.JSON.decode!()
|> Map.get(:geometries)
|> Enum.map(&update_map_keys/1)
|> Enum.map(&calculate_bounding_box/1)
|> List.insert_at(0, version)
error ->
raise RuntimeError, "Unable to unzip downloaded data. Error: #{inspect error}"
end
end With that in mind I can try:
I will put two development branches together now so you can test (1) and (2). I'll look at (3) over the weekend. And somehow I have to find a reproducible case I can submit to the OTP team. |
I've done some basic experiments and I see no material difference between using That means that (1) and (2) don't appear to make any material difference in memory consumption. I also added a call to |
That's interesting, this isn't my strongest area but perhaps it could be a memory leak involving linux and OTP 27 since it is seemingly only happening in this linux docker image. I did provide the debian image I am building with. Feel free to take your time as OTP 26 is sufficing quite well. |
Could be related? |
This seems like the problem in my case. I have plenty of memory but am getting runtime crashes on boot that look like other segfault bugs I have seen in the past. Update: actually, I am seeing my application crash even with The only error I see is this:
lang versions: Another update: |
I've pushed [a commit[(https://github.com/kipcole9/tz_world/commit/aad71d3815bf4b16a438ac8d4a07b5f7e125a5d4) that makes some attempt to more aggressively garbage collect the large binaries that get generated during the update process. I don't think this is a comprehensive solution, but I'd be interested if it makes a difference in your situations? Mix.exs
Mix taskI've added a new % mix tz_world.update --trace Feedback most definitely welcome. |
Very interesting - but I don't think it relates to this particular issue? |
You are right. |
Could be related? |
I'm thinking about an overhaul of the whole updating process. Comments would be most welcome.
I will ship one more maintenance release on the current structure that supports |
A further update here as I am about to publish a new release. This release has the % mix tz_world.update --trace
09:32:41.549 [debug] [52 MiB] Retrieved list of 21 available timezone data releases.
09:32:41.549 [info] [TzWorld] No timezone geo data installed. Installing the latest release 2024b.
09:33:04.268 [debug] [1712 MiB] Transforming source data
09:33:12.340 [debug] [1226 MiB] Transformed source data
09:33:18.489 [debug] [235 MiB] Compressed data into a zip file
09:33:18.489 [debug] [97 MiB] Reloading timezone data
09:33:23.355 [debug] [603 MiB] Reloaded timezone data Any feedback about what you observe will be most welcome. |
EDIT: I narrowed it down further and was able to build on 1.17.2 and OTP 26.2.5.2. So it looks like the problem is OTP 27.0.1
I am on
tz_world 1.3.3
Hey, i've updated to 1.17 but am unable to deploy due to a significant increase in memory usage when running
tz_world.update
compared to 1.15.Here are the two docker images. 1.15.7 builds perfectly and the image with 1.17 OOMs after 4gb of usage.
Elixir 1.15.7 OTP 25.3.2.7 Working image
Elixir 1.17.2 OTP 27.0.1 OOM
Any ideas?
The text was updated successfully, but these errors were encountered: