-
-
Notifications
You must be signed in to change notification settings - Fork 309
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
Artifact downloading from Hydra buffers the whole artifact into RAM before sending it #1357
Labels
Comments
This sometimes ends up hogging all workers on h.n.o, causing the website to become unavailable and channel scripts to fail. |
Ma27
pushed a commit
to Ma27/hydra
that referenced
this issue
Aug 17, 2024
When an artifact is requested from hydra the output is first copied from the nix store into memory and then sent as a response, delaying the download and taking up significant amounts of memory. As reported in NixOS#1357 Instead of calling a command and blocking while reading in the entire output, this adds read_into_socket(). the function takes a command, starting a subprocess with that command, returning a file descriptor attached to stdout. This file descriptor is then by responsebuilder of Catalyst to steam the output directly
@Ma27 is the referenced commit working and worth testing on h.n.o? |
mweinelt
pushed a commit
that referenced
this issue
Jan 13, 2025
When an artifact is requested from hydra the output is first copied from the nix store into memory and then sent as a response, delaying the download and taking up significant amounts of memory. As reported in #1357 Instead of calling a command and blocking while reading in the entire output, this adds read_into_socket(). the function takes a command, starting a subprocess with that command, returning a file descriptor attached to stdout. This file descriptor is then by responsebuilder of Catalyst to steam the output directly (cherry picked from commit 459aa0a)
Thanks, I picked both patches and deployed them. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hydra/src/lib/Hydra/Controller/Build.pm
Line 239 in c1bd50a
The way Hydra artifacts downloads works is that it runs "nix store cat", reads the whole contents into RAM, and then sends it as HTTP response. This has multiple issues for larger files (e.g. disk images):
We noticed it a few weeks ago on #infra:nixos.org but then this got rediscovered again today on #hydra:nixos.org so I thought it might be worth filing a bug to actually track this.
The text was updated successfully, but these errors were encountered: