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

Update and unify limits across systemd and macOS. #1126

Merged
merged 6 commits into from
Aug 30, 2024
Merged

Conversation

grahamc
Copy link
Member

@grahamc grahamc commented Aug 30, 2024

Description
  1. Raise the NOFILE limit to 512 * 1024 * 1024 after hitting limits talking to caches

See: NixOS/nix#11387

  1. Set the default stack limit to 64M

Amazon Linux 2023 and likely CentOS / RedHat sets the default stack limit to 10M, and is generally effective at building nixpkgs. One notable exception is Nix, which typically sets it stack size to 64M. When it could not do that, a test around the stack overflow behavior failed. This was fixed in NixOS/nix#10903 to use less stack. However, since Nix typically can use a 64M stack we set that as the default max.

We should not treat this value as magically correct. If this value causes problems, we should freely raise it. It is possible infinity is the right answer. 64M is attempting to be a "good guess" at a universally applicable good start.

This bug report to systemd regarding LimitSTACK and DefaultLimitSTACK might be useful: systemd/systemd#34193.

  1. Echo TasksMax from the systemd unit to the macOS plist

...plus a bunch of clippy cleanup.

Replaces #1121, #1125.

Checklist
  • Formatted with cargo fmt
  • Built with nix build
  • Ran flake checks with nix flake check
  • Added or updated relevant tests (leave unchecked if not applicable)
  • Added or updated relevant documentation (leave unchecked if not applicable)
  • Linked to related issues (leave unchecked if not applicable)
Validating with install.determinate.systems

If a maintainer has added the upload to s3 label to this PR, it will become available for installation via install.determinate.systems:

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix/pr/$PR_NUMBER | sh -s -- install

Amazon Linux 2023 and likely CentOS / RedHat sets the default stack limit to 10M, and is generally effective at building nixpkgs. One notable exception is Nix, which typically sets it stack size to 64M. When it could not do that, a test around the stack overflow behavior failed. This was fixed in NixOS/nix#10903 to use less stack. However, since Nix typically can use a 64M stack we set that as the default max.

We should not treat this value as magically correct. If this value causes problems, we should freely raise it. It is possible infinity is the right answer. 64M is attempting to be a "good guess" at a universally applicable good start.

For future readers, this bug report to systemd regarding LimitSTACK and DefaultLimitSTACK might be useful: systemd/systemd#34193.
@grahamc grahamc requested a review from cole-h August 30, 2024 17:05
@cole-h cole-h enabled auto-merge (squash) August 30, 2024 17:09
@cole-h cole-h disabled auto-merge August 30, 2024 17:10
@grahamc grahamc enabled auto-merge (squash) August 30, 2024 17:12
@grahamc grahamc merged commit 88077e7 into main Aug 30, 2024
20 checks passed
@grahamc grahamc deleted the unify-limits branch August 30, 2024 17:20
@cole-h cole-h added this to the 0.23.0 milestone Aug 30, 2024
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 this pull request may close these issues.

2 participants