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

Add nix processes command #3800

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

matthewbauer
Copy link
Member

@matthewbauer matthewbauer commented Jul 11, 2020

adds a processes command for #3751

some thing still missing:

  • mostly relies on procfs for cmdline info
  • no phase reporting

output looks like:

Build User: nixbld1
Build Process: nix-daemon 3535     
Child Process: /nix/store/b3zsk4ihlpiimv3vff86bb5bxghgdzb9-gcc-9.2.0/libexec/gcc/x86_64-unknown-linux-gnu/9.2.0/cc1 -quiet -D _FORTIFY_SOURCE=2 -idirafter /nix/store/fwpn2f7a4iqszyydw7ag61zlnp6xk5d3-glibc-2.30-dev/include -idirafter /nix/store/b3zsk4ihlpiimv3vff86bb5bxghgdzb9-gcc-9.2.0/lib/gcc/x86_64-unknown-linux-gnu/9.2.0/include-fixed conftest.c -quiet -dumpbase conftest.c -mtune=generic -march=x86-64 -auxbase conftest -g -O2 -O2 -Wformat=1 -Wformat-security -Werror=format-security -fstack-protector-strong -fno-strict-overflow -fPIC --param ssp-buffer-size=4 -o /build/cceFfp2A.s 
File Lock: /nix/store/l285fr6qxcf0v0iaphs38lcghv206zar-hello-2.10.lock

@matthewbauer matthewbauer changed the title WIP: Add nix processes command Add nix processes command Jul 11, 2020
when we have a cmdline, just show that, the build pid is not very
useful.
Sometimes these processes will end while we're processing them. We
just need to continue in this case since we can't find what pid
replaced it.
@matthewbauer matthewbauer changed the title Add nix processes command WIP: Add nix processes command Jul 11, 2020
@matthewbauer
Copy link
Member Author

Ok - this actually doesn't quite work. The userpool locks are always owned by the same process in the nix-daemon. We'll need to filter by uid to determine what the actual pid is.

@matthewbauer matthewbauer changed the title WIP: Add nix processes command \Add nix processes command Jul 13, 2020
@matthewbauer matthewbauer changed the title \Add nix processes command Add nix processes command Jul 13, 2020
@matthewbauer
Copy link
Member Author

Updated to show the correct pid based on uid of the owning process.

@edolstra
Copy link
Member

Not sure this is the best approach. 1) It's Linux specific, so at least there should be a big #if __linux__ around it. 2) It only works when using build users. 3) It make the Nix CLI depend on the internals of LocalStore. For instance, it will break once #3600 gets merged. 4) The name nix processes is a bit vague. (What processes?) Maybe something like nix debug show-daemon-status is better.

@michaelpj
Copy link

It would be very nice to have a command like this in some form, nix-top is very useful.

As for a name, how about nix daemon status?

@Atemu
Copy link
Member

Atemu commented Jul 14, 2020

Status makes me think more of "how's the daemon doing, is it still up?" (though that also sounds useful), how about nix daemon monitor?

You'd use the command to monitor what the daemon is up to atm afterall.

@matthewbauer
Copy link
Member Author

matthewbauer commented Jul 15, 2020

Not sure this is the best approach. 1) It's Linux specific, so at least there should be a big #if __linux__ around it.

That sounds alright. Some non-Linux systems have procfs, but I have no idea whether it looks the same.

  1. It make the Nix CLI depend on the internals of LocalStore. For instance, it will break once Automatic UID allocation #3600 gets merged.

Right - this is just using the locks in the filesystem. These don't end up being as clear as I originally hoped.


What approach would be better? We could keep track of it in nix-daemon - which right now doesn't really know about what builds are happening.

@stale
Copy link

stale bot commented Feb 12, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Feb 12, 2021
@Atemu
Copy link
Member

Atemu commented Feb 12, 2021

Still important to me.

@stale stale bot removed the stale label Feb 12, 2021
@stale
Copy link

stale bot commented Aug 13, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Aug 13, 2021
@matthewbauer matthewbauer marked this pull request as draft October 1, 2021 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants