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

python3Packages.watchdog: fix build #391331

Open
wants to merge 2 commits into
base: staging
Choose a base branch
from
Open

Conversation

oxij
Copy link
Member

@oxij oxij commented Mar 19, 2025

The newly disabled test fails on my machine.

The other change is to make syntax highlight happy.

@oxij
Copy link
Member Author

oxij commented Mar 20, 2025

Hydra thinks it's fine https://hydra.nixos.org/build/292199074 so switched this to be against staging.

I have no idea why that test works on Hydra but fails locally, but it does.

@FliegendeWurst
Copy link
Member

Maybe some invocation of ulimit could increase the max number of open files?

@oxij
Copy link
Member Author

oxij commented Mar 20, 2025 via email

@FliegendeWurst
Copy link
Member

Try preCheck = "ulimit -n $(ulimit -Hn)". This will raise the max. number of open files to the "hard limit", which should be higher than 1024.

@mweinelt
Copy link
Member

mweinelt commented Mar 20, 2025

Are you building in single user mode by chance? Hydra uses the nix-daemon and inherits its increased ulimit.

@oxij oxij force-pushed the pkgs/fix-watchdog branch from ca03b21 to 8a1adc8 Compare March 21, 2025 09:42
@oxij
Copy link
Member Author

oxij commented Mar 21, 2025

@mweinelt I do, yes.

I pushed a new commit raising ulimit -n to 2x of what that test needs, similar to what @FliegendeWurst suggested, and it now passes.

# otherwise "tests/test_inotify_c.py::test_select_fd"
# fails with "OSError: [Errno 24] Too many open files"
preCheck = ''
ulimit -n 4096
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the other tests open at most 2048 files?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's actually a bit more than 2048, since pytest itself opens files too, but yes, it's the only test that opens that many files, AFAICS.

@oxij
Copy link
Member Author

oxij commented Mar 23, 2025

ping?

@mweinelt
Copy link
Member

I'm not super convinced we should manually manage ulimits like that in a derivation.

This is absolutely your environment putting constraints on the build sandbox. Can't you simply lift the fd limits or use NIX_REMOTE=daemon instead?

@oxij
Copy link
Member Author

oxij commented Mar 23, 2025 via email

@emilazy
Copy link
Member

emilazy commented Mar 23, 2025

This isn’t the appropriate place to work around this issue. The existing instances of the pattern in Nixpkgs are basically all there to work around an issue with unreasonably low macOS limits and Hydra not using the daemon that was resolved at the NixOS infra level; see #351783 for what led to that investigation. (I should rebase that PR to drop the existing instances at some point.)

Nix already raises the limit for the daemon in its shipped systemd service and launchd daemon definitions. This issue with single‐user mode should be addressed in Nix by having it raise the limit to match the one it ships for the daemon, to increase uniformity of the build environment. Failing that, I would recommend just adjusting your system configuration. If we do work around the Nix bug, it should be in stdenv, not individual packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants